--- jsr166/src/test/tck/ArrayDequeTest.java 2010/08/25 01:46:24 1.16 +++ jsr166/src/test/tck/ArrayDequeTest.java 2010/11/04 01:04:54 1.19 @@ -620,48 +620,46 @@ public class ArrayDequeTest extends JSR1 } /** - * toArray() contains all elements + * toArray() contains all elements in FIFO order */ public void testToArray() { ArrayDeque q = populatedDeque(SIZE); Object[] o = q.toArray(); - Arrays.sort(o); for (int i = 0; i < o.length; i++) - assertEquals(o[i], q.pollFirst()); + assertSame(o[i], q.pollFirst()); } /** - * toArray(a) contains all elements + * toArray(a) contains all elements in FIFO order */ public void testToArray2() { ArrayDeque q = populatedDeque(SIZE); Integer[] ints = new Integer[SIZE]; - ints = (Integer[])q.toArray(ints); - Arrays.sort(ints); + assertSame(ints, q.toArray(ints)); for (int i = 0; i < ints.length; i++) - assertEquals(ints[i], q.pollFirst()); + assertSame(ints[i], q.remove()); } /** - * toArray(null) throws NPE + * toArray(null) throws NullPointerException */ - public void testToArray_BadArg() { + public void testToArray_NullArg() { ArrayDeque l = new ArrayDeque(); l.add(new Object()); try { - Object o[] = l.toArray(null); + l.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** - * toArray with incompatible array type throws CCE + * toArray(incompatible array type) throws ArrayStoreException */ public void testToArray1_BadArg() { ArrayDeque l = new ArrayDeque(); l.add(new Integer(5)); try { - Object o[] = l.toArray(new String[10]); + l.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} }