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.6 by dl, Sat Dec 27 19:26:43 2003 UTC vs.
Revision 1.9 by dl, Sat Jan 10 01:41:59 2004 UTC

# Line 9 | Line 9
9   import junit.framework.*;
10   import java.util.concurrent.atomic.*;
11   import java.io.*;
12 + import java.util.*;
13  
14   public class AtomicReferenceArrayTest extends JSR166TestCase
15   {
# Line 30 | Line 31 | public class AtomicReferenceArrayTest ex
31      }
32  
33      /**
34 +     * constructor with null array throws NPE
35 +     */
36 +    public void testConstructor2NPE() {
37 +        try {
38 +            Integer[] a = null;
39 +            AtomicReferenceArray<Integer> ai = new AtomicReferenceArray<Integer>(a);
40 +        } catch (NullPointerException success) {
41 +        } catch (Exception ex) {
42 +            unexpectedException();
43 +        }
44 +    }
45 +
46 +    /**
47 +     * constructor with array is of same size and has all elements
48 +     */
49 +    public void testConstructor2() {
50 +        Integer[] a = { two, one, three, four, seven};
51 +        AtomicReferenceArray<Integer> ai = new AtomicReferenceArray<Integer>(a);
52 +        assertEquals(a.length, ai.length());
53 +        for (int i = 0; i < a.length; ++i)
54 +            assertEquals(a[i], ai.get(i));
55 +    }
56 +
57 +
58 +    /**
59       * get and set for out of bound indices throw IndexOutOfBoundsException
60       */
61      public void testIndexing(){
# Line 163 | Line 189 | public class AtomicReferenceArrayTest ex
189          }
190      }
191  
192 +
193 +    /**
194 +     * toString returns current value.
195 +     */
196 +    public void testToString() {
197 +        Integer[] a = { two, one, three, four, seven};
198 +        AtomicReferenceArray<Integer> ai = new AtomicReferenceArray<Integer>(a);
199 +        assertEquals(Arrays.toString(a), ai.toString());
200 +    }
201   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines