--- jsr166/src/test/tck/AtomicBooleanTest.java 2003/12/27 19:26:43 1.6 +++ jsr166/src/test/tck/AtomicBooleanTest.java 2009/11/02 20:28:31 1.10 @@ -2,8 +2,8 @@ * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/licenses/publicdomain - * Other contributors include Andrew Wright, Jeffrey Hayes, - * Pat Fisher, Mike Judd. + * Other contributors include Andrew Wright, Jeffrey Hayes, + * Pat Fisher, Mike Judd. */ import junit.framework.*; @@ -27,7 +27,7 @@ public class AtomicBooleanTest extends J } /** - * default constructed intializes to false + * default constructed initializes to false */ public void testConstructor2() { AtomicBoolean ai = new AtomicBoolean(); @@ -44,7 +44,20 @@ public class AtomicBooleanTest extends J assertEquals(false,ai.get()); ai.set(true); assertEquals(true,ai.get()); - + + } + + /** + * get returns the last value lazySet in same thread + */ + public void testGetLazySet() { + AtomicBoolean ai = new AtomicBoolean(true); + assertEquals(true,ai.get()); + ai.lazySet(false); + assertEquals(false,ai.get()); + ai.lazySet(true); + assertEquals(true,ai.get()); + } /** @@ -85,7 +98,7 @@ public class AtomicBooleanTest extends J /** * repeated weakCompareAndSet succeeds in changing value when equal - * to expected + * to expected */ public void testWeakCompareAndSet() { AtomicBoolean ai = new AtomicBoolean(true); @@ -131,5 +144,14 @@ public class AtomicBooleanTest extends J } } + /** + * toString returns current value. + */ + public void testToString() { + AtomicBoolean ai = new AtomicBoolean(); + assertEquals(ai.toString(), Boolean.toString(false)); + ai.set(true); + assertEquals(ai.toString(), Boolean.toString(true)); + } }