14 |
|
|
15 |
|
public class PriorityBlockingQueueTest extends JSR166TestCase { |
16 |
|
public static void main(String[] args) { |
17 |
< |
junit.textui.TestRunner.run (suite()); |
17 |
> |
junit.textui.TestRunner.run(suite()); |
18 |
|
} |
19 |
|
public static Test suite() { |
20 |
|
return new TestSuite(PriorityBlockingQueueTest.class); |
245 |
|
shouldThrow(); |
246 |
|
} catch (NullPointerException success) {} |
247 |
|
} |
248 |
+ |
|
249 |
|
/** |
250 |
|
* addAll of a collection with any null elements throws NPE after |
251 |
|
* possibly adding some elements |
664 |
|
/** |
665 |
|
* iterator.remove removes current element |
666 |
|
*/ |
667 |
< |
public void testIteratorRemove () { |
667 |
> |
public void testIteratorRemove() { |
668 |
|
final PriorityBlockingQueue q = new PriorityBlockingQueue(3); |
669 |
|
q.add(new Integer(2)); |
670 |
|
q.add(new Integer(1)); |
700 |
|
ExecutorService executor = Executors.newFixedThreadPool(2); |
701 |
|
executor.execute(new CheckedRunnable() { |
702 |
|
public void realRun() throws InterruptedException { |
703 |
< |
threadAssertNull(q.poll()); |
704 |
< |
threadAssertTrue(null != q.poll(MEDIUM_DELAY_MS, MILLISECONDS)); |
705 |
< |
threadAssertTrue(q.isEmpty()); |
703 |
> |
assertNull(q.poll()); |
704 |
> |
assertSame(one, q.poll(MEDIUM_DELAY_MS, MILLISECONDS)); |
705 |
> |
assertTrue(q.isEmpty()); |
706 |
|
}}); |
707 |
|
|
708 |
|
executor.execute(new CheckedRunnable() { |
709 |
|
public void realRun() throws InterruptedException { |
710 |
|
Thread.sleep(SMALL_DELAY_MS); |
711 |
< |
q.put(new Integer(1)); |
711 |
> |
q.put(one); |
712 |
|
}}); |
713 |
|
|
714 |
|
joinPool(executor); |