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.15 by jsr166, Sat Nov 21 02:07:26 2009 UTC vs.
Revision 1.20 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 30 | Line 30 | public class AtomicIntegerFieldUpdaterTe
30                  a = AtomicIntegerFieldUpdater.newUpdater
31                  (AtomicIntegerFieldUpdaterTest.class, "y");
32              shouldThrow();
33 <        }
34 <        catch (RuntimeException rt) {}
33 >        } catch (RuntimeException success) {}
34      }
35  
36      /**
# Line 43 | Line 42 | public class AtomicIntegerFieldUpdaterTe
42                  a = AtomicIntegerFieldUpdater.newUpdater
43                  (AtomicIntegerFieldUpdaterTest.class, "z");
44              shouldThrow();
45 <        }
47 <        catch (RuntimeException rt) {}
45 >        } catch (RuntimeException success) {}
46      }
47  
48      /**
# Line 56 | Line 54 | public class AtomicIntegerFieldUpdaterTe
54                  a = AtomicIntegerFieldUpdater.newUpdater
55                  (AtomicIntegerFieldUpdaterTest.class, "w");
56              shouldThrow();
57 <        }
60 <        catch (RuntimeException rt) {}
57 >        } catch (RuntimeException success) {}
58      }
59  
60      /**
61 <     *  get returns the last value set or assigned
61 >     * get returns the last value set or assigned
62       */
63      public void testGetSet() {
64          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a;
# Line 76 | Line 73 | public class AtomicIntegerFieldUpdaterTe
73          assertEquals(2,a.get(this));
74          a.set(this,-3);
75          assertEquals(-3,a.get(this));
79
76      }
77  
78      /**
79 <     *  get returns the last value lazySet by same thread
79 >     * get returns the last value lazySet by same thread
80       */
81      public void testGetLazySet() {
82          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a;
# Line 95 | Line 91 | public class AtomicIntegerFieldUpdaterTe
91          assertEquals(2,a.get(this));
92          a.lazySet(this,-3);
93          assertEquals(-3,a.get(this));
98
94      }
95  
96      /**
# Line 113 | Line 108 | public class AtomicIntegerFieldUpdaterTe
108          assertTrue(a.compareAndSet(this,2,-4));
109          assertEquals(-4,a.get(this));
110          assertFalse(a.compareAndSet(this,-5,7));
111 <        assertFalse((7 == a.get(this)));
111 >        assertEquals(-4,a.get(this));
112          assertTrue(a.compareAndSet(this,-4,7));
113          assertEquals(7,a.get(this));
114      }
115  
121
116      /**
117       * compareAndSet in one thread enables another waiting for value
118       * to succeed
# Line 165 | Line 159 | public class AtomicIntegerFieldUpdaterTe
159      }
160  
161      /**
162 <     *  getAndSet returns previous value and sets to given value
162 >     * getAndSet returns previous value and sets to given value
163       */
164      public void testGetAndSet() {
165          AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines