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.17 by jsr166, Sat Nov 21 17:38:05 2009 UTC vs.
Revision 1.22 by jsr166, Fri May 27 19:39:07 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   * Other contributors include Andrew Wright, Jeffrey Hayes,
6   * Pat Fisher, Mike Judd.
7   */
# Line 34 | Line 34 | public class AtomicReferenceFieldUpdater
34          } catch (RuntimeException success) {}
35      }
36  
37
37      /**
38       * construction with field not of given type throws RuntimeException
39       */
# Line 60 | Line 59 | public class AtomicReferenceFieldUpdater
59      }
60  
61      /**
62 <     *  get returns the last value set or assigned
62 >     * get returns the last value set or assigned
63       */
64      public void testGetSet() {
65          AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a;
# Line 70 | Line 69 | public class AtomicReferenceFieldUpdater
69              return;
70          }
71          x = one;
72 <        assertEquals(one,a.get(this));
72 >        assertSame(one,a.get(this));
73          a.set(this,two);
74 <        assertEquals(two,a.get(this));
74 >        assertSame(two,a.get(this));
75          a.set(this,m3);
76 <        assertEquals(m3,a.get(this));
76 >        assertSame(m3,a.get(this));
77      }
78  
79      /**
80 <     *  get returns the last value lazySet by same thread
80 >     * get returns the last value lazySet by same thread
81       */
82      public void testGetLazySet() {
83          AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a;
# Line 88 | Line 87 | public class AtomicReferenceFieldUpdater
87              return;
88          }
89          x = one;
90 <        assertEquals(one,a.get(this));
90 >        assertSame(one,a.get(this));
91          a.lazySet(this,two);
92 <        assertEquals(two,a.get(this));
92 >        assertSame(two,a.get(this));
93          a.lazySet(this,m3);
94 <        assertEquals(m3,a.get(this));
94 >        assertSame(m3,a.get(this));
95      }
96  
97      /**
# Line 106 | Line 105 | public class AtomicReferenceFieldUpdater
105              return;
106          }
107          x = one;
108 <        assertTrue(a.compareAndSet(this,one,two));
109 <        assertTrue(a.compareAndSet(this,two,m4));
110 <        assertEquals(m4,a.get(this));
111 <        assertFalse(a.compareAndSet(this,m5,seven));
112 <        assertFalse((seven == a.get(this)));
113 <        assertTrue(a.compareAndSet(this,m4,seven));
114 <        assertEquals(seven,a.get(this));
108 >        assertTrue(a.compareAndSet(this, one, two));
109 >        assertTrue(a.compareAndSet(this, two, m4));
110 >        assertSame(m4, a.get(this));
111 >        assertFalse(a.compareAndSet(this, m5, seven));
112 >        assertFalse(seven == a.get(this));
113 >        assertTrue(a.compareAndSet(this, m4, seven));
114 >        assertSame(seven,a.get(this));
115      }
116  
117      /**
# Line 138 | Line 137 | public class AtomicReferenceFieldUpdater
137          assertTrue(a.compareAndSet(this, one, two));
138          t.join(LONG_DELAY_MS);
139          assertFalse(t.isAlive());
140 <        assertEquals(a.get(this), three);
140 >        assertSame(a.get(this), three);
141      }
142  
143      /**
# Line 155 | Line 154 | public class AtomicReferenceFieldUpdater
154          x = one;
155          while (!a.weakCompareAndSet(this,one,two));
156          while (!a.weakCompareAndSet(this,two,m4));
157 <        assertEquals(m4,a.get(this));
157 >        assertSame(m4,a.get(this));
158          while (!a.weakCompareAndSet(this,m4,seven));
159 <        assertEquals(seven,a.get(this));
159 >        assertSame(seven,a.get(this));
160      }
161  
162      /**
# Line 171 | Line 170 | public class AtomicReferenceFieldUpdater
170              return;
171          }
172          x = one;
173 <        assertEquals(one,a.getAndSet(this, zero));
174 <        assertEquals(zero,a.getAndSet(this,m10));
175 <        assertEquals(m10,a.getAndSet(this,1));
173 >        assertSame(one,a.getAndSet(this, zero));
174 >        assertSame(zero,a.getAndSet(this,m10));
175 >        assertSame(m10,a.getAndSet(this,1));
176      }
177  
178   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines