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

Comparing jsr166/src/test/tck/AtomicReferenceFieldUpdaterTest.java (file contents):
Revision 1.1 by dl, Sun Aug 31 19:24:53 2003 UTC vs.
Revision 1.3 by dl, Sat Sep 20 18:20:07 2003 UTC

# Line 9 | Line 9 | import java.util.concurrent.atomic.*;
9   import junit.framework.*;
10   import java.util.*;
11  
12 < public class AtomicReferenceFieldUpdaterTest extends TestCase{
12 > public class AtomicReferenceFieldUpdaterTest extends JSR166TestCase{
13      volatile Integer x = null;
14      Object z;
15      Integer w;
# Line 23 | Line 23 | public class AtomicReferenceFieldUpdater
23          return new TestSuite(AtomicReferenceFieldUpdaterTest.class);
24      }
25  
26 <    static final Integer zero = new Integer(0);
27 <    static final Integer one = new Integer(1);
28 <    static final Integer two = new Integer(2);
29 <    static final Integer m3  = new Integer(-3);
30 <    static final Integer m4 = new Integer(-4);
31 <    static final Integer m5 = new Integer(-5);
32 <    static final Integer seven = new Integer(7);
33 <    static final Integer m10 = new Integer(-10);
34 <
26 >    /**
27 >     *
28 >     */
29      public void testConstructor(){
30          try{
31              AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>
32                  a = AtomicReferenceFieldUpdater.newUpdater
33                  (getClass(), Integer.class, "y");
34 <            fail("Exception not thrown");
34 >            shouldThrow();
35          }
42
36          catch (RuntimeException rt) {}
37      }
38  
39  
40 +    /**
41 +     *
42 +     */
43      public void testConstructor2(){
44          try{
45              AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>
46                  a = AtomicReferenceFieldUpdater.newUpdater
47                  (getClass(), Integer.class, "z");
48 <            fail("Exception not thrown");
48 >            shouldThrow();
49          }
54
50          catch (RuntimeException rt) {}
51      }
52  
53 +    /**
54 +     *
55 +     */
56      public void testConstructor3(){
57          try{
58              AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>
59                  a = AtomicReferenceFieldUpdater.newUpdater
60                  (getClass(), Integer.class, "w");
61 <            fail("Exception not thrown");
61 >            shouldThrow();
62          }
65
63          catch (RuntimeException rt) {}
64      }
65  
66 +    /**
67 +     *
68 +     */
69      public void testGetSet(){
70          AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a = AtomicReferenceFieldUpdater.newUpdater(getClass(), Integer.class, "x");
71          x = one;
# Line 76 | Line 76 | public class AtomicReferenceFieldUpdater
76          assertEquals(-3,a.get(this));
77          
78      }
79 +    /**
80 +     *
81 +     */
82      public void testCompareAndSet(){
83          AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a = AtomicReferenceFieldUpdater.newUpdater(getClass(), Integer.class, "x");
84          x = one;
# Line 88 | Line 91 | public class AtomicReferenceFieldUpdater
91          assertEquals(seven,a.get(this));
92      }
93  
94 +    /**
95 +     *
96 +     */
97      public void testWeakCompareAndSet(){
98          AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a = AtomicReferenceFieldUpdater.newUpdater(getClass(), Integer.class, "x");
99          x = one;
# Line 98 | Line 104 | public class AtomicReferenceFieldUpdater
104          assertEquals(seven,a.get(this));
105      }
106  
107 +    /**
108 +     *
109 +     */
110      public void testGetAndSet(){
111          AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a = AtomicReferenceFieldUpdater.newUpdater(getClass(), Integer.class, "x");
112          x = one;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines