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

Comparing jsr166/src/test/tck/AtomicIntegerFieldUpdaterTest.java (file contents):
Revision 1.2 by dl, Sun Sep 14 20:42:40 2003 UTC vs.
Revision 1.3 by dl, Sat Sep 20 18:20:07 2003 UTC

# Line 22 | Line 22 | public class AtomicIntegerFieldUpdaterTe
22          return new TestSuite(AtomicIntegerFieldUpdaterTest.class);
23      }
24  
25 <    public void testConstructor(){
25 >    /**
26 >     *
27 >     */
28 >    public void testConstructor() {
29          try{
30              AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest>
31                  a = AtomicIntegerFieldUpdater.newUpdater
32                  (getClass(), "y");
33 <            fail("Exception not thrown");
33 >            shouldThrow();
34          }
35          catch (RuntimeException rt) {}
36      }
37  
38 <    public void testConstructor2(){
38 >    /**
39 >     *
40 >     */
41 >    public void testConstructor2() {
42          try{
43              AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest>
44                  a = AtomicIntegerFieldUpdater.newUpdater
45                  (getClass(), "z");
46 <            fail("Exception not thrown");
46 >            shouldThrow();
47          }
48          catch (RuntimeException rt) {}
49      }
50  
51 <    public void testGetSet(){
51 >    /**
52 >     *
53 >     */
54 >    public void testGetSet() {
55          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a = AtomicIntegerFieldUpdater.newUpdater(getClass(), "x");
56          x = 1;
57          assertEquals(1,a.get(this));
# Line 52 | Line 61 | public class AtomicIntegerFieldUpdaterTe
61          assertEquals(-3,a.get(this));
62          
63      }
64 <    public void testCompareAndSet(){
64 >    /**
65 >     *
66 >     */
67 >    public void testCompareAndSet() {
68          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a = AtomicIntegerFieldUpdater.newUpdater(getClass(), "x");
69          x = 1;
70          assertTrue(a.compareAndSet(this,1,2));
# Line 64 | Line 76 | public class AtomicIntegerFieldUpdaterTe
76          assertEquals(7,a.get(this));
77      }
78  
79 <    public void testWeakCompareAndSet(){
79 >    /**
80 >     *
81 >     */
82 >    public void testWeakCompareAndSet() {
83          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a = AtomicIntegerFieldUpdater.newUpdater(getClass(), "x");
84          x = 1;
85          while(!a.weakCompareAndSet(this,1,2));
# Line 74 | Line 89 | public class AtomicIntegerFieldUpdaterTe
89          assertEquals(7,a.get(this));
90      }
91  
92 <    public void testGetAndSet(){
92 >    /**
93 >     *
94 >     */
95 >    public void testGetAndSet() {
96          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a = AtomicIntegerFieldUpdater.newUpdater(getClass(), "x");
97          x = 1;
98          assertEquals(1,a.getAndSet(this, 0));
# Line 82 | Line 100 | public class AtomicIntegerFieldUpdaterTe
100          assertEquals(-10,a.getAndSet(this,1));
101      }
102  
103 <    public void testGetAndAdd(){
103 >    /**
104 >     *
105 >     */
106 >    public void testGetAndAdd() {
107          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a = AtomicIntegerFieldUpdater.newUpdater(getClass(), "x");
108          x = 1;
109          assertEquals(1,a.getAndAdd(this,2));
# Line 91 | Line 112 | public class AtomicIntegerFieldUpdaterTe
112          assertEquals(-1,a.get(this));
113      }
114  
115 <    public void testGetAndDecrement(){
115 >    /**
116 >     *
117 >     */
118 >    public void testGetAndDecrement() {
119          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a = AtomicIntegerFieldUpdater.newUpdater(getClass(), "x");
120          x = 1;
121          assertEquals(1,a.getAndDecrement(this));
# Line 99 | Line 123 | public class AtomicIntegerFieldUpdaterTe
123          assertEquals(-1,a.getAndDecrement(this));
124      }
125  
126 <    public void testGetAndIncrement(){
126 >    /**
127 >     *
128 >     */
129 >    public void testGetAndIncrement() {
130          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a = AtomicIntegerFieldUpdater.newUpdater(getClass(), "x");
131          x = 1;
132          assertEquals(1,a.getAndIncrement(this));
# Line 111 | Line 138 | public class AtomicIntegerFieldUpdaterTe
138          assertEquals(1,a.get(this));
139      }
140  
141 <    public void testAddAndGet(){
141 >    /**
142 >     *
143 >     */
144 >    public void testAddAndGet() {
145          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a = AtomicIntegerFieldUpdater.newUpdater(getClass(), "x");
146          x = 1;
147          assertEquals(3,a.addAndGet(this,2));
# Line 120 | Line 150 | public class AtomicIntegerFieldUpdaterTe
150          assertEquals(-1,a.get(this));
151      }
152  
153 <    public void testDecrementAndGet(){
153 >    /**
154 >     *
155 >     */
156 >    public void testDecrementAndGet() {
157          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a = AtomicIntegerFieldUpdater.newUpdater(getClass(), "x");
158          x = 1;
159          assertEquals(0,a.decrementAndGet(this));
# Line 129 | Line 162 | public class AtomicIntegerFieldUpdaterTe
162          assertEquals(-2,a.get(this));
163      }
164  
165 <    public void testIncrementAndGet(){
165 >    /**
166 >     *
167 >     */
168 >    public void testIncrementAndGet() {
169          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a = AtomicIntegerFieldUpdater.newUpdater(getClass(), "x");
170          x = 1;
171          assertEquals(2,a.incrementAndGet(this));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines