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

Comparing jsr166/src/test/tck/ArrayDequeTest.java (file contents):
Revision 1.16 by jsr166, Wed Aug 25 01:46:24 2010 UTC vs.
Revision 1.19 by jsr166, Thu Nov 4 01:04:54 2010 UTC

# Line 620 | Line 620 | public class ArrayDequeTest extends JSR1
620      }
621  
622      /**
623 <     * toArray() contains all elements
623 >     * toArray() contains all elements in FIFO order
624       */
625      public void testToArray() {
626          ArrayDeque q = populatedDeque(SIZE);
627          Object[] o = q.toArray();
628        Arrays.sort(o);
628          for (int i = 0; i < o.length; i++)
629 <            assertEquals(o[i], q.pollFirst());
629 >            assertSame(o[i], q.pollFirst());
630      }
631  
632      /**
633 <     * toArray(a) contains all elements
633 >     * toArray(a) contains all elements in FIFO order
634       */
635      public void testToArray2() {
636          ArrayDeque q = populatedDeque(SIZE);
637          Integer[] ints = new Integer[SIZE];
638 <        ints = (Integer[])q.toArray(ints);
640 <        Arrays.sort(ints);
638 >        assertSame(ints, q.toArray(ints));
639          for (int i = 0; i < ints.length; i++)
640 <            assertEquals(ints[i], q.pollFirst());
640 >            assertSame(ints[i], q.remove());
641      }
642  
643      /**
644 <     * toArray(null) throws NPE
644 >     * toArray(null) throws NullPointerException
645       */
646 <    public void testToArray_BadArg() {
646 >    public void testToArray_NullArg() {
647          ArrayDeque l = new ArrayDeque();
648          l.add(new Object());
649          try {
650 <            Object o[] = l.toArray(null);
650 >            l.toArray(null);
651              shouldThrow();
652          } catch (NullPointerException success) {}
653      }
654  
655      /**
656 <     * toArray with incompatible array type throws CCE
656 >     * toArray(incompatible array type) throws ArrayStoreException
657       */
658      public void testToArray1_BadArg() {
659          ArrayDeque l = new ArrayDeque();
660          l.add(new Integer(5));
661          try {
662 <            Object o[] = l.toArray(new String[10]);
662 >            l.toArray(new String[10]);
663              shouldThrow();
664          } catch (ArrayStoreException success) {}
665      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines