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

Comparing jsr166/src/test/tck/AtomicBooleanTest.java (file contents):
Revision 1.23 by jsr166, Wed Dec 31 19:21:20 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 AtomicBooleanTest 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(AtomicBooleanTest.class);
# Line 109 | Line 109 | public class AtomicBooleanTest extends J
109       * getAndSet returns previous value and sets to given value
110       */
111      public void testGetAndSet() {
112 <        AtomicBoolean ai = new AtomicBoolean(true);
113 <        assertEquals(true, ai.getAndSet(false));
114 <        assertEquals(false, ai.getAndSet(false));
115 <        assertEquals(false, ai.getAndSet(true));
116 <        assertTrue(ai.get());
112 >        AtomicBoolean ai = new AtomicBoolean();
113 >        boolean[] booleans = { false, true };
114 >        for (boolean before : booleans)
115 >            for (boolean after : booleans) {
116 >                ai.set(before);
117 >                assertEquals(before, ai.getAndSet(after));
118 >                assertEquals(after, ai.get());
119 >            }
120      }
121  
122      /**
123 <     * a deserialized serialized atomic holds same value
123 >     * a deserialized/reserialized atomic holds same value
124       */
125      public void testSerialization() throws Exception {
126          AtomicBoolean x = new AtomicBoolean();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines