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.21 by jsr166, Tue Mar 15 19:47:06 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 60 | Line 60 | public class AtomicReferenceFieldUpdater
60      }
61  
62      /**
63 <     *  get returns the last value set or assigned
63 >     * get returns the last value set or assigned
64       */
65      public void testGetSet() {
66          AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a;
# Line 70 | Line 70 | public class AtomicReferenceFieldUpdater
70              return;
71          }
72          x = one;
73 <        assertEquals(one,a.get(this));
73 >        assertSame(one,a.get(this));
74          a.set(this,two);
75 <        assertEquals(two,a.get(this));
75 >        assertSame(two,a.get(this));
76          a.set(this,m3);
77 <        assertEquals(m3,a.get(this));
77 >        assertSame(m3,a.get(this));
78      }
79  
80      /**
81 <     *  get returns the last value lazySet by same thread
81 >     * get returns the last value lazySet by same thread
82       */
83      public void testGetLazySet() {
84          AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a;
# Line 88 | Line 88 | public class AtomicReferenceFieldUpdater
88              return;
89          }
90          x = one;
91 <        assertEquals(one,a.get(this));
91 >        assertSame(one,a.get(this));
92          a.lazySet(this,two);
93 <        assertEquals(two,a.get(this));
93 >        assertSame(two,a.get(this));
94          a.lazySet(this,m3);
95 <        assertEquals(m3,a.get(this));
95 >        assertSame(m3,a.get(this));
96      }
97  
98      /**
# Line 106 | Line 106 | public class AtomicReferenceFieldUpdater
106              return;
107          }
108          x = one;
109 <        assertTrue(a.compareAndSet(this,one,two));
110 <        assertTrue(a.compareAndSet(this,two,m4));
111 <        assertEquals(m4,a.get(this));
112 <        assertFalse(a.compareAndSet(this,m5,seven));
113 <        assertFalse((seven == a.get(this)));
114 <        assertTrue(a.compareAndSet(this,m4,seven));
115 <        assertEquals(seven,a.get(this));
109 >        assertTrue(a.compareAndSet(this, one, two));
110 >        assertTrue(a.compareAndSet(this, two, m4));
111 >        assertSame(m4, a.get(this));
112 >        assertFalse(a.compareAndSet(this, m5, seven));
113 >        assertFalse(seven == a.get(this));
114 >        assertTrue(a.compareAndSet(this, m4, seven));
115 >        assertSame(seven,a.get(this));
116      }
117  
118      /**
# Line 138 | Line 138 | public class AtomicReferenceFieldUpdater
138          assertTrue(a.compareAndSet(this, one, two));
139          t.join(LONG_DELAY_MS);
140          assertFalse(t.isAlive());
141 <        assertEquals(a.get(this), three);
141 >        assertSame(a.get(this), three);
142      }
143  
144      /**
# Line 155 | Line 155 | public class AtomicReferenceFieldUpdater
155          x = one;
156          while (!a.weakCompareAndSet(this,one,two));
157          while (!a.weakCompareAndSet(this,two,m4));
158 <        assertEquals(m4,a.get(this));
158 >        assertSame(m4,a.get(this));
159          while (!a.weakCompareAndSet(this,m4,seven));
160 <        assertEquals(seven,a.get(this));
160 >        assertSame(seven,a.get(this));
161      }
162  
163      /**
# Line 171 | Line 171 | public class AtomicReferenceFieldUpdater
171              return;
172          }
173          x = one;
174 <        assertEquals(one,a.getAndSet(this, zero));
175 <        assertEquals(zero,a.getAndSet(this,m10));
176 <        assertEquals(m10,a.getAndSet(this,1));
174 >        assertSame(one,a.getAndSet(this, zero));
175 >        assertSame(zero,a.getAndSet(this,m10));
176 >        assertSame(m10,a.getAndSet(this,1));
177      }
178  
179   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines