--- jsr166/src/test/tck/AtomicLongTest.java 2011/08/09 04:49:38 1.25 +++ jsr166/src/test/tck/AtomicLongTest.java 2016/06/17 19:00:48 1.32 @@ -6,12 +6,14 @@ * Pat Fisher, Mike Judd. */ -import junit.framework.*; import java.util.concurrent.atomic.AtomicLong; +import junit.framework.Test; +import junit.framework.TestSuite; + public class AtomicLongTest extends JSR166TestCase { public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); + main(suite(), args); } public static Test suite() { return new TestSuite(AtomicLongTest.class); @@ -102,10 +104,10 @@ public class AtomicLongTest extends JSR1 */ public void testWeakCompareAndSet() { AtomicLong ai = new AtomicLong(1); - while (!ai.weakCompareAndSet(1, 2)); - while (!ai.weakCompareAndSet(2, -4)); + do {} while (!ai.weakCompareAndSet(1, 2)); + do {} while (!ai.weakCompareAndSet(2, -4)); assertEquals(-4, ai.get()); - while (!ai.weakCompareAndSet(-4, 7)); + do {} while (!ai.weakCompareAndSet(-4, 7)); assertEquals(7, ai.get()); } @@ -196,9 +198,10 @@ public class AtomicLongTest extends JSR1 public void testSerialization() throws Exception { AtomicLong x = new AtomicLong(); AtomicLong y = serialClone(x); - assertTrue(x != y); + assertNotSame(x, y); x.set(-22); AtomicLong z = serialClone(x); + assertNotSame(y, z); assertEquals(-22, x.get()); assertEquals(0, y.get()); assertEquals(-22, z.get());