ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/AtomicReferenceArrayTest.java
(Generate patch)

Comparing jsr166/src/test/tck/AtomicReferenceArrayTest.java (file contents):
Revision 1.21 by jsr166, Tue May 31 16:16:23 2011 UTC vs.
Revision 1.23 by jsr166, Fri Jun 10 19:45:01 2011 UTC

# Line 43 | Line 43 | public class AtomicReferenceArrayTest ex
43       * constructor with array is of same size and has all elements
44       */
45      public void testConstructor2() {
46 <        Integer[] a = { two, one, three, four, seven};
46 >        Integer[] a = { two, one, three, four, seven };
47          AtomicReferenceArray<Integer> ai = new AtomicReferenceArray<Integer>(a);
48          assertEquals(a.length, ai.length());
49          for (int i = 0; i < a.length; ++i)
# Line 51 | Line 51 | public class AtomicReferenceArrayTest ex
51      }
52  
53      /**
54 +     * Initialize AtomicReference<Class> with SubClass[]
55 +     */
56 +    public void testConstructorSubClassArray() {
57 +        Integer[] a = { two, one, three, four, seven };
58 +        AtomicReferenceArray<Number> aa = new AtomicReferenceArray<Number>(a);
59 +        assertEquals(a.length, aa.length());
60 +        for (int i = 0; i < a.length; ++i) {
61 +            assertSame(a[i], aa.get(i));
62 +            Long x = Long.valueOf(i);
63 +            aa.set(i, x);
64 +            assertSame(x, aa.get(i));
65 +        }
66 +    }
67 +
68 +    /**
69       * get and set for out of bound indices throw IndexOutOfBoundsException
70       */
71      public void testIndexing() {
# Line 193 | Line 208 | public class AtomicReferenceArrayTest ex
208       * toString returns current value.
209       */
210      public void testToString() {
211 <        Integer[] a = { two, one, three, four, seven};
211 >        Integer[] a = { two, one, three, four, seven };
212          AtomicReferenceArray<Integer> ai = new AtomicReferenceArray<Integer>(a);
213          assertEquals(Arrays.toString(a), ai.toString());
214      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines