31 |
|
|
32 |
|
public static class InitialCapacity extends BlockingQueueTest { |
33 |
|
protected BlockingQueue emptyCollection() { |
34 |
< |
return new PriorityBlockingQueue(20); |
34 |
> |
return new PriorityBlockingQueue(SIZE); |
35 |
|
} |
36 |
|
} |
37 |
|
|
459 |
|
} |
460 |
|
|
461 |
|
/** |
462 |
– |
* remove(x) removes x and returns true if present |
463 |
– |
*/ |
464 |
– |
public void testRemoveElement() { |
465 |
– |
PriorityBlockingQueue q = populatedQueue(SIZE); |
466 |
– |
for (int i = 1; i < SIZE; i+=2) { |
467 |
– |
assertTrue(q.contains(i)); |
468 |
– |
assertTrue(q.remove(i)); |
469 |
– |
assertFalse(q.contains(i)); |
470 |
– |
assertTrue(q.contains(i-1)); |
471 |
– |
} |
472 |
– |
for (int i = 0; i < SIZE; i+=2) { |
473 |
– |
assertTrue(q.contains(i)); |
474 |
– |
assertTrue(q.remove(i)); |
475 |
– |
assertFalse(q.contains(i)); |
476 |
– |
assertFalse(q.remove(i+1)); |
477 |
– |
assertFalse(q.contains(i+1)); |
478 |
– |
} |
479 |
– |
assertTrue(q.isEmpty()); |
480 |
– |
} |
481 |
– |
|
482 |
– |
/** |
462 |
|
* contains(x) reports true when elements added but not yet removed |
463 |
|
*/ |
464 |
|
public void testContains() { |