305 |
|
q.put(null); |
306 |
|
shouldThrow(); |
307 |
|
} |
308 |
< |
catch (NullPointerException success){ |
308 |
> |
catch (NullPointerException success) { |
309 |
|
} |
310 |
|
} |
311 |
|
|
354 |
|
q.take(); |
355 |
|
t.interrupt(); |
356 |
|
t.join(); |
357 |
< |
} catch (Exception e){ |
357 |
> |
} catch (Exception e) { |
358 |
|
unexpectedException(); |
359 |
|
} |
360 |
|
} |
380 |
|
Thread.sleep(SMALL_DELAY_MS); |
381 |
|
t.interrupt(); |
382 |
|
t.join(); |
383 |
< |
} catch (Exception e){ |
383 |
> |
} catch (Exception e) { |
384 |
|
unexpectedException(); |
385 |
|
} |
386 |
|
} |
394 |
|
for (int i = 0; i < SIZE; ++i) { |
395 |
|
assertEquals(i, ((Integer)q.take()).intValue()); |
396 |
|
} |
397 |
< |
} catch (InterruptedException e){ |
397 |
> |
} catch (InterruptedException e) { |
398 |
|
unexpectedException(); |
399 |
|
} |
400 |
|
} |
409 |
|
try { |
410 |
|
q.take(); |
411 |
|
threadShouldThrow(); |
412 |
< |
} catch (InterruptedException success){ } |
412 |
> |
} catch (InterruptedException success) { } |
413 |
|
} |
414 |
|
}); |
415 |
|
try { |
417 |
|
Thread.sleep(SHORT_DELAY_MS); |
418 |
|
t.interrupt(); |
419 |
|
t.join(); |
420 |
< |
} catch (Exception e){ |
420 |
> |
} catch (Exception e) { |
421 |
|
unexpectedException(); |
422 |
|
} |
423 |
|
} |
435 |
|
} |
436 |
|
q.take(); |
437 |
|
threadShouldThrow(); |
438 |
< |
} catch (InterruptedException success){ |
438 |
> |
} catch (InterruptedException success) { |
439 |
|
} |
440 |
|
}}); |
441 |
|
t.start(); |
471 |
|
assertEquals(i, ((Integer)q.poll(0, TimeUnit.MILLISECONDS)).intValue()); |
472 |
|
} |
473 |
|
assertNull(q.poll(0, TimeUnit.MILLISECONDS)); |
474 |
< |
} catch (InterruptedException e){ |
474 |
> |
} catch (InterruptedException e) { |
475 |
|
unexpectedException(); |
476 |
|
} |
477 |
|
} |
486 |
|
assertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)).intValue()); |
487 |
|
} |
488 |
|
assertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
489 |
< |
} catch (InterruptedException e){ |
489 |
> |
} catch (InterruptedException e) { |
490 |
|
unexpectedException(); |
491 |
|
} |
492 |
|
} |
504 |
|
threadAssertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)).intValue()); |
505 |
|
} |
506 |
|
threadAssertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
507 |
< |
} catch (InterruptedException success){ |
507 |
> |
} catch (InterruptedException success) { |
508 |
|
} |
509 |
|
}}); |
510 |
|
t.start(); |
540 |
|
assertTrue(q.offer(new Integer(0), SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
541 |
|
t.interrupt(); |
542 |
|
t.join(); |
543 |
< |
} catch (Exception e){ |
543 |
> |
} catch (Exception e) { |
544 |
|
unexpectedException(); |
545 |
|
} |
546 |
|
} |
587 |
|
try { |
588 |
|
q.remove(); |
589 |
|
shouldThrow(); |
590 |
< |
} catch (NoSuchElementException success){ |
590 |
> |
} catch (NoSuchElementException success) { |
591 |
|
} |
592 |
|
} |
593 |
|
|
692 |
|
try { |
693 |
|
for (int i = 0; i < o.length; i++) |
694 |
|
assertEquals(o[i], q.take()); |
695 |
< |
} catch (InterruptedException e){ |
695 |
> |
} catch (InterruptedException e) { |
696 |
|
unexpectedException(); |
697 |
|
} |
698 |
|
} |
708 |
|
try { |
709 |
|
for (int i = 0; i < ints.length; i++) |
710 |
|
assertEquals(ints[i], q.take()); |
711 |
< |
} catch (InterruptedException e){ |
711 |
> |
} catch (InterruptedException e) { |
712 |
|
unexpectedException(); |
713 |
|
} |
714 |
|
} |
721 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
722 |
|
Object o[] = q.toArray(null); |
723 |
|
shouldThrow(); |
724 |
< |
} catch (NullPointerException success){} |
724 |
> |
} catch (NullPointerException success) {} |
725 |
|
} |
726 |
|
|
727 |
|
/** |
732 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
733 |
|
Object o[] = q.toArray(new String[10] ); |
734 |
|
shouldThrow(); |
735 |
< |
} catch (ArrayStoreException success){} |
735 |
> |
} catch (ArrayStoreException success) {} |
736 |
|
} |
737 |
|
|
738 |
|
/** |
831 |
|
assertEquals(q.size(), r.size()); |
832 |
|
while (!q.isEmpty()) |
833 |
|
assertEquals(q.remove(), r.remove()); |
834 |
< |
} catch (Exception e){ |
834 |
> |
} catch (Exception e) { |
835 |
|
unexpectedException(); |
836 |
|
} |
837 |
|
} |
903 |
|
assertEquals(l.get(i), new Integer(i)); |
904 |
|
t.join(); |
905 |
|
assertTrue(q.size() + l.size() >= SIZE); |
906 |
< |
} catch (Exception e){ |
906 |
> |
} catch (Exception e) { |
907 |
|
unexpectedException(); |
908 |
|
} |
909 |
|
} |