565 |
|
* contains(x) reports true when elements added but not yet removed |
566 |
|
*/ |
567 |
|
public void testContains() { |
568 |
< |
ArrayBlockingQueue q = populatedQueue(SIZE); |
569 |
< |
for (int i = 0; i < SIZE; ++i) { |
568 |
> |
int size = ThreadLocalRandom.current().nextInt(1, SIZE); |
569 |
> |
ArrayBlockingQueue q = populatedQueue(size, size, 2 * size, false); |
570 |
> |
assertFalse(q.contains(null)); |
571 |
> |
for (int i = 0; i < size; ++i) { |
572 |
|
assertTrue(q.contains(new Integer(i))); |
573 |
|
assertEquals(i, q.poll()); |
574 |
|
assertFalse(q.contains(new Integer(i))); |