--- jsr166/src/test/tck/PriorityBlockingQueueTest.java 2010/10/28 17:57:26 1.33 +++ jsr166/src/test/tck/PriorityBlockingQueueTest.java 2010/11/05 00:17:22 1.38 @@ -49,8 +49,9 @@ public class PriorityBlockingQueueTest e * Create a queue of given size containing consecutive * Integers 0 ... n. */ - private PriorityBlockingQueue populatedQueue(int n) { - PriorityBlockingQueue q = new PriorityBlockingQueue(n); + private PriorityBlockingQueue populatedQueue(int n) { + PriorityBlockingQueue q = + new PriorityBlockingQueue(n); assertTrue(q.isEmpty()); for (int i = n-1; i >= 0; i-=2) assertTrue(q.offer(new Integer(i))); @@ -400,7 +401,7 @@ public class PriorityBlockingQueueTest e } /** - * timed pool with zero timeout succeeds when non-empty, else times out + * timed poll with zero timeout succeeds when non-empty, else times out */ public void testTimedPoll0() throws InterruptedException { PriorityBlockingQueue q = populatedQueue(SIZE); @@ -411,7 +412,7 @@ public class PriorityBlockingQueueTest e } /** - * timed pool with nonzero timeout succeeds when non-empty, else times out + * timed poll with nonzero timeout succeeds when non-empty, else times out */ public void testTimedPoll() throws InterruptedException { PriorityBlockingQueue q = populatedQueue(SIZE); @@ -586,39 +587,40 @@ public class PriorityBlockingQueueTest e Object[] o = q.toArray(); Arrays.sort(o); for (int i = 0; i < o.length; i++) - assertEquals(o[i], q.take()); + assertSame(o[i], q.take()); } /** * toArray(a) contains all elements */ public void testToArray2() throws InterruptedException { - PriorityBlockingQueue q = populatedQueue(SIZE); + PriorityBlockingQueue q = populatedQueue(SIZE); Integer[] ints = new Integer[SIZE]; - ints = (Integer[])q.toArray(ints); + Integer[] array = q.toArray(ints); + assertSame(ints, array); Arrays.sort(ints); for (int i = 0; i < ints.length; i++) - assertEquals(ints[i], q.take()); + assertSame(ints[i], q.take()); } /** - * toArray(null) throws NPE + * toArray(null) throws NullPointerException */ - public void testToArray_BadArg() { + public void testToArray_NullArg() { PriorityBlockingQueue q = populatedQueue(SIZE); try { - Object o[] = q.toArray(null); + q.toArray(null); shouldThrow(); } catch (NullPointerException success) {} } /** - * toArray with incompatible array type throws CCE + * toArray(incompatible array type) throws ArrayStoreException */ public void testToArray1_BadArg() { PriorityBlockingQueue q = populatedQueue(SIZE); try { - Object o[] = q.toArray(new String[10]); + q.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} }