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

Comparing jsr166/src/test/tck/DelayQueueTest.java (file contents):
Revision 1.21 by jsr166, Sat Nov 21 10:29:50 2009 UTC vs.
Revision 1.24 by jsr166, Sat Nov 21 22:00:46 2009 UTC

# Line 375 | Line 375 | public class DelayQueueTest extends JSR1
375              public void realRun() throws InterruptedException {
376                  q.put(new PDelay(0));
377                  q.put(new PDelay(0));
378 <                threadAssertTrue(q.offer(new PDelay(0), SHORT_DELAY_MS, MILLISECONDS));
379 <                threadAssertTrue(q.offer(new PDelay(0), LONG_DELAY_MS, MILLISECONDS));
378 >                assertTrue(q.offer(new PDelay(0), SHORT_DELAY_MS, MILLISECONDS));
379 >                assertTrue(q.offer(new PDelay(0), LONG_DELAY_MS, MILLISECONDS));
380              }});
381  
382          t.start();
# Line 476 | Line 476 | public class DelayQueueTest extends JSR1
476                      assertEquals(new PDelay(i), ((PDelay)q.poll(SHORT_DELAY_MS, MILLISECONDS)));
477                  }
478                  try {
479 <                    q.poll(LONG_DELAY_MS, MILLISECONDS);
479 >                    q.poll(SMALL_DELAY_MS, MILLISECONDS);
480                      shouldThrow();
481                  } catch (InterruptedException success) {}
482              }});
# Line 493 | Line 493 | public class DelayQueueTest extends JSR1
493       */
494      public void testTimedPollWithOffer() throws InterruptedException {
495          final DelayQueue q = new DelayQueue();
496 +        final PDelay pdelay = new PDelay(0);
497          Thread t = new Thread(new CheckedRunnable() {
498              public void realRun() throws InterruptedException {
499                  assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
500 <                q.poll(LONG_DELAY_MS, MILLISECONDS);
500 >                assertSame(pdelay, q.poll(LONG_DELAY_MS, MILLISECONDS));
501                  try {
502                      q.poll(LONG_DELAY_MS, MILLISECONDS);
503                      shouldThrow();
# Line 505 | Line 506 | public class DelayQueueTest extends JSR1
506  
507          t.start();
508          Thread.sleep(SMALL_DELAY_MS);
509 <        assertTrue(q.offer(new PDelay(0), SHORT_DELAY_MS, MILLISECONDS));
509 >        assertTrue(q.offer(pdelay, SHORT_DELAY_MS, MILLISECONDS));
510          t.interrupt();
511          t.join();
512      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines