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

Comparing jsr166/src/test/tck/SynchronousQueueTest.java (file contents):
Revision 1.49 by jsr166, Sun Oct 4 18:28:51 2015 UTC vs.
Revision 1.56 by jsr166, Sun May 14 00:56:43 2017 UTC

# Line 138 | Line 138 | public class SynchronousQueueTest extend
138              }});
139  
140          await(pleaseInterrupt);
141 <        assertThreadStaysAlive(t);
141 >        assertThreadBlocks(t, Thread.State.WAITING);
142          t.interrupt();
143          awaitTermination(t);
144          assertEquals(0, q.remainingCapacity());
# Line 172 | Line 172 | public class SynchronousQueueTest extend
172          catch (InterruptedException e) { threadUnexpectedException(e); }
173  
174          await(pleaseInterrupt);
175 <        assertThreadStaysAlive(t);
175 >        assertThreadBlocks(t, Thread.State.WAITING);
176          t.interrupt();
177          awaitTermination(t);
178          assertEquals(0, q.remainingCapacity());
# Line 196 | Line 196 | public class SynchronousQueueTest extend
196                      q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
197                      shouldThrow();
198                  } catch (InterruptedException success) {}
199 +                assertFalse(Thread.interrupted());
200              }});
201  
202          await(pleaseInterrupt);
203 <        assertThreadStaysAlive(t);
203 >        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
204          t.interrupt();
205          awaitTermination(t);
206      }
# Line 257 | Line 258 | public class SynchronousQueueTest extend
258                  pleaseOffer.countDown();
259                  startTime = System.nanoTime();
260                  assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS));
260                assertTrue(millisElapsedSince(startTime) < MEDIUM_DELAY_MS);
261  
262                  Thread.currentThread().interrupt();
263                  try {
# Line 272 | Line 272 | public class SynchronousQueueTest extend
272                      shouldThrow();
273                  } catch (InterruptedException success) {}
274                  assertFalse(Thread.interrupted());
275 +
276 +                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
277              }});
278  
279          await(pleaseOffer);
280          long startTime = System.nanoTime();
281          try { assertTrue(q.offer(zero, LONG_DELAY_MS, MILLISECONDS)); }
282          catch (InterruptedException e) { threadUnexpectedException(e); }
283 <        assertTrue(millisElapsedSince(startTime) < MEDIUM_DELAY_MS);
283 >        assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
284  
285          await(pleaseInterrupt);
286 <        assertThreadStaysAlive(t);
286 >        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
287          t.interrupt();
288          awaitTermination(t);
289      }
# Line 400 | Line 402 | public class SynchronousQueueTest extend
402      public void testToArray2()      { testToArray2(false); }
403      public void testToArray2_fair() { testToArray2(true); }
404      public void testToArray2(boolean fair) {
405 <        final SynchronousQueue<Integer> q
404 <            = new SynchronousQueue<Integer>(fair);
405 >        final SynchronousQueue<Integer> q = new SynchronousQueue<>(fair);
406          Integer[] a;
407  
408          a = new Integer[0];
# Line 569 | Line 570 | public class SynchronousQueueTest extend
570                  fail("timed out");
571              Thread.yield();
572          }
573 <        assertTrue(l.size() == 1);
573 >        assertEquals(1, l.size());
574          assertSame(one, l.get(0));
575          awaitTermination(t);
576      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines