From ea623e575eb48564459e840a3ec130d65e370339 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Sat, 13 Nov 2010 23:16:49 +0000 Subject: [PATCH] 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 --- .../lang3/concurrent/ConstantInitializerTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java index 74c11ea1d..8b17c6db6 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java @@ -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()); + } } }