--- jsr166/src/test/tck/AtomicReferenceArrayTest.java 2011/05/31 16:16:23 1.21 +++ jsr166/src/test/tck/AtomicReferenceArrayTest.java 2011/06/10 19:45:01 1.23 @@ -43,7 +43,7 @@ public class AtomicReferenceArrayTest ex * constructor with array is of same size and has all elements */ public void testConstructor2() { - Integer[] a = { two, one, three, four, seven}; + Integer[] a = { two, one, three, four, seven }; AtomicReferenceArray ai = new AtomicReferenceArray(a); assertEquals(a.length, ai.length()); for (int i = 0; i < a.length; ++i) @@ -51,6 +51,21 @@ public class AtomicReferenceArrayTest ex } /** + * Initialize AtomicReference with SubClass[] + */ + public void testConstructorSubClassArray() { + Integer[] a = { two, one, three, four, seven }; + AtomicReferenceArray aa = new AtomicReferenceArray(a); + assertEquals(a.length, aa.length()); + for (int i = 0; i < a.length; ++i) { + assertSame(a[i], aa.get(i)); + Long x = Long.valueOf(i); + aa.set(i, x); + assertSame(x, aa.get(i)); + } + } + + /** * get and set for out of bound indices throw IndexOutOfBoundsException */ public void testIndexing() { @@ -193,7 +208,7 @@ public class AtomicReferenceArrayTest ex * toString returns current value. */ public void testToString() { - Integer[] a = { two, one, three, four, seven}; + Integer[] a = { two, one, three, four, seven }; AtomicReferenceArray ai = new AtomicReferenceArray(a); assertEquals(Arrays.toString(a), ai.toString()); }