--- jsr166/src/test/tck/AtomicLongTest.java 2013/05/30 03:28:55 1.26 +++ jsr166/src/test/tck/AtomicLongTest.java 2021/01/26 13:33:05 1.34 @@ -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); @@ -100,12 +102,13 @@ public class AtomicLongTest extends JSR1 * repeated weakCompareAndSet succeeds in changing value when equal * to expected */ + @SuppressWarnings("deprecation") 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()); } @@ -191,7 +194,7 @@ public class AtomicLongTest extends JSR1 } /** - * a deserialized serialized atomic holds same value + * a deserialized/reserialized atomic holds same value */ public void testSerialization() throws Exception { AtomicLong x = new AtomicLong();