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.75 by jsr166, Sun Oct 4 18:49:02 2015 UTC vs.
Revision 1.77 by jsr166, Thu Sep 15 17:07:16 2016 UTC

# Line 94 | Line 94 | public class DelayQueueTest extends JSR1
94          }
95  
96          public boolean equals(Object other) {
97 <            return equals((NanoDelay)other);
98 <        }
99 <        public boolean equals(NanoDelay other) {
100 <            return other.trigger == trigger;
97 >            return (other instanceof NanoDelay) &&
98 >                this.trigger == ((NanoDelay)other).trigger;
99          }
100  
101          // suppress [overrides] javac warning
# Line 412 | Line 410 | public class DelayQueueTest extends JSR1
410       */
411      public void testInterruptedTimedPoll() throws InterruptedException {
412          final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
413 +        final DelayQueue q = populatedQueue(SIZE);
414          Thread t = newStartedThread(new CheckedRunnable() {
415              public void realRun() throws InterruptedException {
416 <                DelayQueue q = populatedQueue(SIZE);
416 >                long startTime = System.nanoTime();
417                  for (int i = 0; i < SIZE; ++i) {
418 <                    assertEquals(new PDelay(i), ((PDelay)q.poll(SHORT_DELAY_MS, MILLISECONDS)));
418 >                    assertEquals(new PDelay(i),
419 >                                 ((PDelay)q.poll(LONG_DELAY_MS, MILLISECONDS)));
420                  }
421  
422                  Thread.currentThread().interrupt();
# Line 432 | Line 432 | public class DelayQueueTest extends JSR1
432                      shouldThrow();
433                  } catch (InterruptedException success) {}
434                  assertFalse(Thread.interrupted());
435 +                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
436              }});
437  
438          await(pleaseInterrupt);
439          assertThreadStaysAlive(t);
440          t.interrupt();
441          awaitTermination(t);
442 +        checkEmpty(q);
443      }
444  
445      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines