--- jsr166/src/test/tck/DelayQueueTest.java 2010/10/28 17:57:26 1.40 +++ jsr166/src/test/tck/DelayQueueTest.java 2010/11/18 18:49:18 1.46 @@ -109,8 +109,8 @@ public class DelayQueueTest extends JSR1 * Create a queue of given size containing consecutive * PDelays 0 ... n. */ - private DelayQueue populatedQueue(int n) { - DelayQueue q = new DelayQueue(); + private DelayQueue populatedQueue(int n) { + DelayQueue q = new DelayQueue(); assertTrue(q.isEmpty()); for (int i = n-1; i >= 0; i-=2) assertTrue(q.offer(new PDelay(i))); @@ -402,7 +402,7 @@ public class DelayQueueTest extends JSR1 try { q.take(); shouldThrow(); - } catch (InterruptedException expected) {} + } catch (InterruptedException success) {} assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS); }}); threadStarted.await(); @@ -448,7 +448,7 @@ public class DelayQueueTest extends JSR1 } /** - * 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 { DelayQueue q = populatedQueue(SIZE); @@ -459,7 +459,7 @@ public class DelayQueueTest extends JSR1 } /** - * 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 { DelayQueue q = populatedQueue(SIZE); @@ -676,40 +676,41 @@ public class DelayQueueTest extends JSR1 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 { - DelayQueue q = populatedQueue(SIZE); + public void testToArray2() { + DelayQueue q = populatedQueue(SIZE); PDelay[] ints = new PDelay[SIZE]; - ints = (PDelay[])q.toArray(ints); + PDelay[] 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.remove()); } /** - * toArray(null) throws NPE + * toArray(null) throws NullPointerException */ - public void testToArray_BadArg() { + public void testToArray_NullArg() { DelayQueue 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() { DelayQueue q = populatedQueue(SIZE); try { - Object o[] = q.toArray(new String[10]); + q.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} }