29 |
|
|
30 |
|
public static class Bounded extends BlockingQueueTest { |
31 |
|
protected BlockingQueue emptyCollection() { |
32 |
< |
return new LinkedBlockingDeque(20); |
32 |
> |
return new LinkedBlockingDeque(SIZE); |
33 |
|
} |
34 |
|
} |
35 |
|
|
1400 |
|
} |
1401 |
|
|
1402 |
|
/** |
1403 |
– |
* remove(x) removes x and returns true if present |
1404 |
– |
*/ |
1405 |
– |
public void testRemoveElement() { |
1406 |
– |
LinkedBlockingDeque q = populatedDeque(SIZE); |
1407 |
– |
for (int i = 1; i < SIZE; i+=2) { |
1408 |
– |
assertTrue(q.contains(i)); |
1409 |
– |
assertTrue(q.remove(i)); |
1410 |
– |
assertFalse(q.contains(i)); |
1411 |
– |
assertTrue(q.contains(i-1)); |
1412 |
– |
} |
1413 |
– |
for (int i = 0; i < SIZE; i+=2) { |
1414 |
– |
assertTrue(q.contains(i)); |
1415 |
– |
assertTrue(q.remove(i)); |
1416 |
– |
assertFalse(q.contains(i)); |
1417 |
– |
assertFalse(q.remove(i+1)); |
1418 |
– |
assertFalse(q.contains(i+1)); |
1419 |
– |
} |
1420 |
– |
assertTrue(q.isEmpty()); |
1421 |
– |
} |
1422 |
– |
|
1423 |
– |
/** |
1403 |
|
* contains(x) reports true when elements added but not yet removed |
1404 |
|
*/ |
1405 |
|
public void testContains() { |
1479 |
|
/** |
1480 |
|
* toArray contains all elements in FIFO order |
1481 |
|
*/ |
1482 |
< |
public void testToArray() throws InterruptedException{ |
1482 |
> |
public void testToArray() throws InterruptedException { |
1483 |
|
LinkedBlockingDeque q = populatedDeque(SIZE); |
1484 |
|
Object[] o = q.toArray(); |
1485 |
|
for (int i = 0; i < o.length; i++) |