24 |
|
|
25 |
|
public static class Fair extends BlockingQueueTest { |
26 |
|
protected BlockingQueue emptyCollection() { |
27 |
< |
return new ArrayBlockingQueue(20, true); |
27 |
> |
return new ArrayBlockingQueue(SIZE, true); |
28 |
|
} |
29 |
|
} |
30 |
|
|
31 |
|
public static class NonFair extends BlockingQueueTest { |
32 |
|
protected BlockingQueue emptyCollection() { |
33 |
< |
return new ArrayBlockingQueue(20, false); |
33 |
> |
return new ArrayBlockingQueue(SIZE, false); |
34 |
|
} |
35 |
|
} |
36 |
|
|
515 |
|
} |
516 |
|
|
517 |
|
/** |
518 |
– |
* remove(x) removes x and returns true if present |
519 |
– |
*/ |
520 |
– |
public void testRemoveElement() { |
521 |
– |
ArrayBlockingQueue q = populatedQueue(SIZE); |
522 |
– |
for (int i = 1; i < SIZE; i+=2) { |
523 |
– |
assertTrue(q.remove(new Integer(i))); |
524 |
– |
} |
525 |
– |
for (int i = 0; i < SIZE; i+=2) { |
526 |
– |
assertTrue(q.remove(new Integer(i))); |
527 |
– |
assertFalse(q.remove(new Integer(i+1))); |
528 |
– |
} |
529 |
– |
assertTrue(q.isEmpty()); |
530 |
– |
} |
531 |
– |
|
532 |
– |
/** |
518 |
|
* contains(x) reports true when elements added but not yet removed |
519 |
|
*/ |
520 |
|
public void testContains() { |