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

Comparing jsr166/src/test/tck/PriorityBlockingQueueTest.java (file contents):
Revision 1.65 by jsr166, Sun Oct 4 18:49:02 2015 UTC vs.
Revision 1.67 by jsr166, Wed Jun 1 16:08:04 2016 UTC

# Line 200 | Line 200 | public class PriorityBlockingQueueTest e
200          PriorityBlockingQueue q = new PriorityBlockingQueue(1);
201          try {
202              q.offer(new Object());
203            q.offer(new Object());
203              shouldThrow();
204 <        } catch (ClassCastException success) {}
204 >        } catch (ClassCastException success) {
205 >            assertTrue(q.isEmpty());
206 >            assertEquals(0, q.size());
207 >            assertNull(q.poll());
208 >        }
209      }
210  
211      /**
# Line 393 | Line 396 | public class PriorityBlockingQueueTest e
396          final CountDownLatch aboutToWait = new CountDownLatch(1);
397          Thread t = newStartedThread(new CheckedRunnable() {
398              public void realRun() throws InterruptedException {
399 +                long startTime = System.nanoTime();
400                  for (int i = 0; i < SIZE; ++i) {
397                    long t0 = System.nanoTime();
401                      assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
399                    assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS);
402                  }
401                long t0 = System.nanoTime();
403                  aboutToWait.countDown();
404                  try {
405                      q.poll(LONG_DELAY_MS, MILLISECONDS);
406                      shouldThrow();
407                  } catch (InterruptedException success) {
408 <                    assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS);
408 >                    assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
409                  }
410              }});
411  
412          aboutToWait.await();
413 <        waitForThreadToEnterWaitState(t, SMALL_DELAY_MS);
413 >        waitForThreadToEnterWaitState(t, LONG_DELAY_MS);
414          t.interrupt();
415 <        awaitTermination(t, MEDIUM_DELAY_MS);
415 >        awaitTermination(t);
416      }
417  
418      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines