--- jsr166/src/test/tck/AtomicReferenceTest.java 2013/05/30 03:28:55 1.21 +++ jsr166/src/test/tck/AtomicReferenceTest.java 2017/03/18 20:42:20 1.28 @@ -6,12 +6,14 @@ * Pat Fisher, Mike Judd. */ -import junit.framework.*; import java.util.concurrent.atomic.AtomicReference; +import junit.framework.Test; +import junit.framework.TestSuite; + public class AtomicReferenceTest extends JSR166TestCase { public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); + main(suite(), args); } public static Test suite() { return new TestSuite(AtomicReferenceTest.class); @@ -96,10 +98,10 @@ public class AtomicReferenceTest extends */ public void testWeakCompareAndSet() { AtomicReference ai = new AtomicReference(one); - while (!ai.weakCompareAndSet(one, two)); - while (!ai.weakCompareAndSet(two, m4)); + do {} while (!ai.weakCompareAndSet(one, two)); + do {} while (!ai.weakCompareAndSet(two, m4)); assertSame(m4, ai.get()); - while (!ai.weakCompareAndSet(m4, seven)); + do {} while (!ai.weakCompareAndSet(m4, seven)); assertSame(seven, ai.get()); } @@ -124,7 +126,7 @@ public class AtomicReferenceTest extends AtomicReference z = serialClone(x); assertNotSame(y, z); assertEquals(one, x.get()); - assertEquals(null, y.get()); + assertNull(y.get()); assertEquals(one, z.get()); } @@ -132,7 +134,7 @@ public class AtomicReferenceTest extends * toString returns current value. */ public void testToString() { - AtomicReference ai = new AtomicReference(one); + AtomicReference ai = new AtomicReference<>(one); assertEquals(one.toString(), ai.toString()); ai.set(two); assertEquals(two.toString(), ai.toString());