ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/AtomicReferenceTest.java
(Generate patch)

Comparing jsr166/src/test/tck/AtomicReferenceTest.java (file contents):
Revision 1.22 by jsr166, Wed Dec 31 19:05:42 2014 UTC vs.
Revision 1.29 by jsr166, Fri Aug 4 03:30:21 2017 UTC

# Line 13 | Line 13 | import junit.framework.TestSuite;
13  
14   public class AtomicReferenceTest extends JSR166TestCase {
15      public static void main(String[] args) {
16 <        junit.textui.TestRunner.run(suite());
16 >        main(suite(), args);
17      }
18      public static Test suite() {
19          return new TestSuite(AtomicReferenceTest.class);
# Line 98 | Line 98 | public class AtomicReferenceTest extends
98       */
99      public void testWeakCompareAndSet() {
100          AtomicReference ai = new AtomicReference(one);
101 <        while (!ai.weakCompareAndSet(one, two));
102 <        while (!ai.weakCompareAndSet(two, m4));
101 >        do {} while (!ai.weakCompareAndSet(one, two));
102 >        do {} while (!ai.weakCompareAndSet(two, m4));
103          assertSame(m4, ai.get());
104 <        while (!ai.weakCompareAndSet(m4, seven));
104 >        do {} while (!ai.weakCompareAndSet(m4, seven));
105          assertSame(seven, ai.get());
106      }
107  
# Line 116 | Line 116 | public class AtomicReferenceTest extends
116      }
117  
118      /**
119 <     * a deserialized serialized atomic holds same value
119 >     * a deserialized/reserialized atomic holds same value
120       */
121      public void testSerialization() throws Exception {
122          AtomicReference x = new AtomicReference();
# Line 126 | Line 126 | public class AtomicReferenceTest extends
126          AtomicReference z = serialClone(x);
127          assertNotSame(y, z);
128          assertEquals(one, x.get());
129 <        assertEquals(null, y.get());
129 >        assertNull(y.get());
130          assertEquals(one, z.get());
131      }
132  
# Line 134 | Line 134 | public class AtomicReferenceTest extends
134       * toString returns current value.
135       */
136      public void testToString() {
137 <        AtomicReference<Integer> ai = new AtomicReference<Integer>(one);
137 >        AtomicReference<Integer> ai = new AtomicReference<>(one);
138          assertEquals(one.toString(), ai.toString());
139          ai.set(two);
140          assertEquals(two.toString(), ai.toString());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines