diff options
author | pascalschumacher <pascalschumacher@gmx.net> | 2017-09-08 18:18:45 +0200 |
---|---|---|
committer | pascalschumacher <pascalschumacher@gmx.net> | 2017-09-08 18:23:03 +0200 |
commit | a2dce32cdab108e7e281dfc27dd0a394e1419ce1 (patch) | |
tree | 72cae70468aa47518ccbeb86162604a466762180 | |
parent | 3e08af573f8b50da5202f55df62c925f88a47f3d (diff) | |
download | apache-commons-lang-a2dce32cdab108e7e281dfc27dd0a394e1419ce1.tar.gz |
LANG-1349: EqualsBuilder#isRegistered: swappedPair construction bug
Add a test and a changes.xml entry.
-rw-r--r-- | src/changes/changes.xml | 3 | ||||
-rw-r--r-- | src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 584647227..ec74e49eb 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -47,7 +47,8 @@ The <action> type attribute can be add,update,fix,remove. <release version="3.7" date="tba" description="tba"> <action issue="LANG-1346" type="update" dev="pschumacher">Remove deprecation from RandomStringUtils</action> - <action issue="LANG-1350" type="update" dev="ggregory" due-to="Brett Kail">ConstructorUtils.invokeConstructor(Class, Object...) regression</action> + <action issue="LANG-1350" type="fix" dev="ggregory" due-to="Brett Kail">ConstructorUtils.invokeConstructor(Class, Object...) regression</action> + <action issue="LANG-1349" type="fix" dev="pschumacher" due-to="Naman Nigam">EqualsBuilder#isRegistered: swappedPair construction bug</action> </release> <release version="3.6" date="2017-06-08" description="New features and bug fixes. Requires Java 7."> 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 3e47b3af4..8dad5e8eb 100644 --- a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java @@ -21,8 +21,10 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import java.lang.reflect.Method; import java.util.Arrays; +import org.apache.commons.lang3.reflect.MethodUtils; import org.junit.Test; /** @@ -1339,5 +1341,17 @@ public class EqualsBuilderTest { assertFalse(new EqualsBuilder().reflectionAppend(null, o2).build()); } + @Test + public void testIsRegistered() throws Exception { + 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 + } } |