198 |
|
final SynchronousQueue q = new SynchronousQueue(); |
199 |
|
Thread t = new Thread(new CheckedInterruptedRunnable() { |
200 |
|
public void realRun() throws InterruptedException { |
201 |
< |
threadAssertFalse(q.offer(new Object(), SHORT_DELAY_MS, MILLISECONDS)); |
201 |
> |
assertFalse(q.offer(new Object(), SHORT_DELAY_MS, MILLISECONDS)); |
202 |
|
q.offer(new Object(), LONG_DELAY_MS, MILLISECONDS); |
203 |
|
}}); |
204 |
|
|
336 |
|
* returning timeout status |
337 |
|
*/ |
338 |
|
public void testInterruptedTimedPoll() throws InterruptedException { |
339 |
+ |
final SynchronousQueue q = new SynchronousQueue(); |
340 |
|
Thread t = new Thread(new CheckedInterruptedRunnable() { |
341 |
|
public void realRun() throws InterruptedException { |
341 |
– |
SynchronousQueue q = new SynchronousQueue(); |
342 |
|
q.poll(SMALL_DELAY_MS, MILLISECONDS); |
343 |
|
}}); |
344 |
|
|
356 |
|
final SynchronousQueue q = new SynchronousQueue(); |
357 |
|
Thread t = new Thread(new CheckedRunnable() { |
358 |
|
public void realRun() throws InterruptedException { |
359 |
< |
threadAssertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); |
359 |
> |
assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); |
360 |
|
assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS)); |
361 |
|
try { |
362 |
|
q.poll(LONG_DELAY_MS, MILLISECONDS); |
363 |
< |
threadShouldThrow(); |
363 |
> |
shouldThrow(); |
364 |
|
} catch (InterruptedException success) {} |
365 |
|
}}); |
366 |
|
|
396 |
|
final SynchronousQueue q = new SynchronousQueue(true); |
397 |
|
Thread t = new Thread(new CheckedRunnable() { |
398 |
|
public void realRun() throws InterruptedException { |
399 |
< |
threadAssertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); |
399 |
> |
assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); |
400 |
|
assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS)); |
401 |
|
try { |
402 |
|
q.poll(LONG_DELAY_MS, MILLISECONDS); |
439 |
|
try { |
440 |
|
q.remove(); |
441 |
|
shouldThrow(); |
442 |
< |
} catch (NoSuchElementException success) { |
443 |
< |
} |
442 |
> |
} catch (NoSuchElementException success) {} |
443 |
|
} |
444 |
|
|
445 |
|
/** |
524 |
|
* toArray(null) throws NPE |
525 |
|
*/ |
526 |
|
public void testToArray_BadArg() { |
527 |
+ |
SynchronousQueue q = new SynchronousQueue(); |
528 |
|
try { |
529 |
– |
SynchronousQueue q = new SynchronousQueue(); |
529 |
|
Object o[] = q.toArray(null); |
530 |
|
shouldThrow(); |
531 |
|
} catch (NullPointerException success) {} |
705 |
|
try { |
706 |
|
q.drainTo(q, 0); |
707 |
|
shouldThrow(); |
708 |
< |
} catch (IllegalArgumentException success) { |
710 |
< |
} |
708 |
> |
} catch (IllegalArgumentException success) {} |
709 |
|
} |
710 |
|
|
711 |
|
/** |