277 |
|
/** |
278 |
|
* put(null) throws NPE |
279 |
|
*/ |
280 |
< |
public void testPutNull() throws InterruptedException { |
280 |
> |
public void testPutNull() throws InterruptedException { |
281 |
|
try { |
282 |
|
LinkedBlockingQueue q = new LinkedBlockingQueue(SIZE); |
283 |
|
q.put(null); |
284 |
|
shouldThrow(); |
285 |
|
} catch (NullPointerException success) {} |
286 |
< |
} |
286 |
> |
} |
287 |
|
|
288 |
|
/** |
289 |
|
* all elements successfully put are contained |
316 |
|
}}); |
317 |
|
|
318 |
|
t.start(); |
319 |
< |
Thread.sleep(SHORT_DELAY_MS); |
319 |
> |
delay(SHORT_DELAY_MS); |
320 |
|
t.interrupt(); |
321 |
|
t.join(); |
322 |
|
assertEquals(SIZE, q.size()); |
340 |
|
}}); |
341 |
|
|
342 |
|
t.start(); |
343 |
< |
Thread.sleep(SHORT_DELAY_MS); |
343 |
> |
delay(SHORT_DELAY_MS); |
344 |
|
assertEquals(q.remainingCapacity(), 0); |
345 |
|
assertEquals(0, q.take()); |
346 |
< |
Thread.sleep(SHORT_DELAY_MS); |
346 |
> |
delay(SHORT_DELAY_MS); |
347 |
|
t.interrupt(); |
348 |
|
t.join(); |
349 |
|
assertEquals(q.remainingCapacity(), 0); |
366 |
|
}}); |
367 |
|
|
368 |
|
t.start(); |
369 |
< |
Thread.sleep(SMALL_DELAY_MS); |
369 |
> |
delay(SMALL_DELAY_MS); |
370 |
|
t.interrupt(); |
371 |
|
t.join(); |
372 |
|
} |
398 |
|
}}); |
399 |
|
|
400 |
|
t.start(); |
401 |
< |
Thread.sleep(SHORT_DELAY_MS); |
401 |
> |
delay(SHORT_DELAY_MS); |
402 |
|
t.interrupt(); |
403 |
|
t.join(); |
404 |
|
} |
758 |
|
|
759 |
|
executor.execute(new CheckedRunnable() { |
760 |
|
public void realRun() throws InterruptedException { |
761 |
< |
Thread.sleep(SMALL_DELAY_MS); |
761 |
> |
delay(SMALL_DELAY_MS); |
762 |
|
assertSame(one, q.take()); |
763 |
|
}}); |
764 |
|
|
780 |
|
|
781 |
|
executor.execute(new CheckedRunnable() { |
782 |
|
public void realRun() throws InterruptedException { |
783 |
< |
Thread.sleep(SMALL_DELAY_MS); |
783 |
> |
delay(SMALL_DELAY_MS); |
784 |
|
q.put(one); |
785 |
|
}}); |
786 |
|
|