Revert bad update in r1034828; fix NPE warning a different way

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1034904 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-11-13 23:16:49 +00:00
parent 35ca6531ef
commit ea623e575e
1 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,6 @@
package org.apache.commons.lang3.concurrent; package org.apache.commons.lang3.concurrent;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -51,13 +50,14 @@ public class ConstantInitializerTest {
*/ */
private void checkEquals(Object obj, boolean expected) { private void checkEquals(Object obj, boolean expected) {
assertEquals("Wrong result of equals", expected, init.equals(obj)); assertEquals("Wrong result of equals", expected, init.equals(obj));
assertNotNull(obj); if (obj != null) {
assertEquals("Not symmetric", expected, obj.equals(init)); assertEquals("Not symmetric", expected, obj.equals(init));
if (expected) { if (expected) {
assertEquals("Different hash codes", init.hashCode(), assertEquals("Different hash codes", init.hashCode(),
obj.hashCode()); obj.hashCode());
} }
} }
}
/** /**
* Tests whether the correct object is returned. * Tests whether the correct object is returned.