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;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.regex.Pattern;
@ -51,11 +50,12 @@ public class ConstantInitializerTest {
*/
private void checkEquals(Object obj, boolean expected) {
assertEquals("Wrong result of equals", expected, init.equals(obj));
assertNotNull(obj);
assertEquals("Not symmetric", expected, obj.equals(init));
if (expected) {
assertEquals("Different hash codes", init.hashCode(),
obj.hashCode());
if (obj != null) {
assertEquals("Not symmetric", expected, obj.equals(init));
if (expected) {
assertEquals("Different hash codes", init.hashCode(),
obj.hashCode());
}
}
}