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

Comparing jsr166/src/test/tck/AtomicLongFieldUpdaterTest.java (file contents):
Revision 1.24 by jsr166, Mon Apr 1 20:58:58 2013 UTC vs.
Revision 1.28 by jsr166, Wed Dec 31 19:21:20 2014 UTC

# Line 6 | Line 6
6   * Pat Fisher, Mike Judd.
7   */
8  
9 import junit.framework.*;
9   import java.util.concurrent.atomic.AtomicLongFieldUpdater;
10  
11 + import junit.framework.Test;
12 + import junit.framework.TestSuite;
13 +
14   public class AtomicLongFieldUpdaterTest extends JSR166TestCase {
15      volatile long x = 0;
16      int z;
# Line 33 | Line 35 | public class AtomicLongFieldUpdaterTest
35          try {
36              updaterFor("y");
37              shouldThrow();
38 <        } catch (RuntimeException success) {}
38 >        } catch (RuntimeException success) {
39 >            assertNotNull(success.getCause());
40 >        }
41      }
42  
43      /**
44 <     * construction with field not of given type throws RuntimeException
44 >     * construction with field not of given type throws IllegalArgumentException
45       */
46      public void testConstructor2() {
47          try {
48              updaterFor("z");
49              shouldThrow();
50 <        } catch (RuntimeException success) {}
50 >        } catch (IllegalArgumentException success) {}
51      }
52  
53      /**
54 <     * construction with non-volatile field throws RuntimeException
54 >     * construction with non-volatile field throws IllegalArgumentException
55       */
56      public void testConstructor3() {
57          try {
58              updaterFor("w");
59              shouldThrow();
60 <        } catch (RuntimeException success) {}
60 >        } catch (IllegalArgumentException success) {}
61      }
62  
63      /**
# Line 130 | Line 134 | public class AtomicLongFieldUpdaterTest
134          AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a;
135          a = updaterFor("x");
136          x = 1;
137 <        while (!a.weakCompareAndSet(this, 1, 2));
138 <        while (!a.weakCompareAndSet(this, 2, -4));
137 >        do {} while (!a.weakCompareAndSet(this, 1, 2));
138 >        do {} while (!a.weakCompareAndSet(this, 2, -4));
139          assertEquals(-4, a.get(this));
140 <        while (!a.weakCompareAndSet(this, -4, 7));
140 >        do {} while (!a.weakCompareAndSet(this, -4, 7));
141          assertEquals(7, a.get(this));
142      }
143  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines