commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject [lang] LANG-1349: EqualsBuilder#isRegistered: swappedPair construction bug
Date Fri, 08 Sep 2017 16:43:26 GMT
Repository: commons-lang
Updated Branches:
  refs/heads/master a2dce32cd -> fdf05fa29


LANG-1349: EqualsBuilder#isRegistered: swappedPair construction bug

Modify test to clean-up registry at the end.


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/fdf05fa2
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/fdf05fa2
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/fdf05fa2

Branch: refs/heads/master
Commit: fdf05fa29babe21e64f9a5b268dc8406d449d4f1
Parents: a2dce32
Author: pascalschumacher <pascalschumacher@gmx.net>
Authored: Fri Sep 8 18:43:16 2017 +0200
Committer: pascalschumacher <pascalschumacher@gmx.net>
Committed: Fri Sep 8 18:43:16 2017 +0200

----------------------------------------------------------------------
 .../commons/lang3/builder/EqualsBuilderTest.java  | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/fdf05fa2/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
index 8dad5e8..d516dca 100644
--- a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
@@ -1346,12 +1346,18 @@ public class EqualsBuilderTest {
         Object firstObject = new Object();
         Object secondObject = new Object();
 
-        Method registerMethod = MethodUtils.getMatchingMethod(EqualsBuilder.class, "register",
Object.class, Object.class);
-        registerMethod.setAccessible(true);
-        registerMethod.invoke(null, firstObject, secondObject);
-
-        assertTrue(EqualsBuilder.isRegistered(firstObject, secondObject));
-        assertTrue(EqualsBuilder.isRegistered(secondObject, firstObject)); // LANG-1349
+        try {
+            Method registerMethod = MethodUtils.getMatchingMethod(EqualsBuilder.class, "register",
Object.class, Object.class);
+            registerMethod.setAccessible(true);
+            registerMethod.invoke(null, firstObject, secondObject);
+
+            assertTrue(EqualsBuilder.isRegistered(firstObject, secondObject));
+            assertTrue(EqualsBuilder.isRegistered(secondObject, firstObject)); // LANG-1349
+        } finally {
+            Method unregisterMethod = MethodUtils.getMatchingMethod(EqualsBuilder.class,
"unregister", Object.class, Object.class);
+            unregisterMethod.setAccessible(true);
+            unregisterMethod.invoke(null, firstObject, secondObject);
+        }
     }
 }
 


Mime
View raw message