--- jsr166/src/test/tck/DelayQueueTest.java 2009/11/21 22:00:46 1.24 +++ jsr166/src/test/tck/DelayQueueTest.java 2009/11/22 18:57:17 1.26 @@ -415,14 +415,17 @@ public class DelayQueueTest extends JSR1 * Take removes existing elements until empty, then blocks interruptibly */ public void testBlockingTake() throws InterruptedException { - Thread t = new ThreadShouldThrow(InterruptedException.class) { + final DelayQueue q = populatedQueue(SIZE); + Thread t = new Thread(new CheckedRunnable() { public void realRun() throws InterruptedException { - DelayQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { - threadAssertEquals(new PDelay(i), ((PDelay)q.take())); + assertEquals(new PDelay(i), ((PDelay)q.take())); } - q.take(); - }}; + try { + q.take(); + shouldThrow(); + } catch (InterruptedException success) {} + }}); t.start(); Thread.sleep(SHORT_DELAY_MS); @@ -519,11 +522,11 @@ public class DelayQueueTest extends JSR1 DelayQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(new PDelay(i), ((PDelay)q.peek())); - q.poll(); + assertEquals(new PDelay(i), ((PDelay)q.poll())); if (q.isEmpty()) assertNull(q.peek()); else - assertTrue(i != ((PDelay)q.peek()).intValue()); + assertFalse(new PDelay(i).equals(q.peek())); } assertNull(q.peek()); } @@ -678,8 +681,8 @@ public class DelayQueueTest extends JSR1 * toArray(null) throws NPE */ public void testToArray_BadArg() { + DelayQueue q = populatedQueue(SIZE); try { - DelayQueue q = populatedQueue(SIZE); Object o[] = q.toArray(null); shouldThrow(); } catch (NullPointerException success) {} @@ -689,9 +692,9 @@ public class DelayQueueTest extends JSR1 * toArray with incompatible array type throws CCE */ public void testToArray1_BadArg() { + DelayQueue q = populatedQueue(SIZE); try { - DelayQueue q = populatedQueue(SIZE); - Object o[] = q.toArray(new String[10] ); + Object o[] = q.toArray(new String[10]); shouldThrow(); } catch (ArrayStoreException success) {} }