442 |
|
} |
443 |
|
|
444 |
|
/** |
445 |
< |
* push succeeds if not full; throws ISE if full |
445 |
> |
* push succeeds if not full; throws IllegalStateException if full |
446 |
|
*/ |
447 |
|
public void testPush() { |
448 |
|
LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); |
492 |
|
} |
493 |
|
|
494 |
|
/** |
495 |
< |
* add succeeds if not full; throws ISE if full |
495 |
> |
* add succeeds if not full; throws IllegalStateException if full |
496 |
|
*/ |
497 |
|
public void testAdd() { |
498 |
|
LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE); |
506 |
|
} |
507 |
|
|
508 |
|
/** |
509 |
< |
* addAll(this) throws IAE |
509 |
> |
* addAll(this) throws IllegalArgumentException |
510 |
|
*/ |
511 |
|
public void testAddAllSelf() { |
512 |
|
LinkedBlockingDeque q = populatedDeque(SIZE); |
1543 |
|
*/ |
1544 |
|
public void testToArray() throws InterruptedException { |
1545 |
|
LinkedBlockingDeque q = populatedDeque(SIZE); |
1546 |
< |
Object[] o = q.toArray(); |
1547 |
< |
for (int i = 0; i < o.length; i++) |
1548 |
< |
assertSame(o[i], q.poll()); |
1546 |
> |
Object[] a = q.toArray(); |
1547 |
> |
assertSame(Object[].class, a.getClass()); |
1548 |
> |
for (Object o : a) |
1549 |
> |
assertSame(o, q.poll()); |
1550 |
> |
assertTrue(q.isEmpty()); |
1551 |
|
} |
1552 |
|
|
1553 |
|
/** |
1558 |
|
Integer[] ints = new Integer[SIZE]; |
1559 |
|
Integer[] array = q.toArray(ints); |
1560 |
|
assertSame(ints, array); |
1561 |
< |
for (int i = 0; i < ints.length; i++) |
1562 |
< |
assertSame(ints[i], q.remove()); |
1561 |
> |
for (Integer o : ints) |
1562 |
> |
assertSame(o, q.remove()); |
1563 |
> |
assertTrue(q.isEmpty()); |
1564 |
|
} |
1565 |
|
|
1566 |
|
/** |
1776 |
|
} |
1777 |
|
|
1778 |
|
/** |
1779 |
< |
* A deserialized serialized deque has same elements in same order |
1779 |
> |
* A deserialized/reserialized deque has same elements in same order |
1780 |
|
*/ |
1781 |
|
public void testSerialization() throws Exception { |
1782 |
|
Queue x = populatedDeque(SIZE); |