475 |
|
*/ |
476 |
|
public void testToArray() { |
477 |
|
LinkedTransferQueue q = populatedQueue(SIZE); |
478 |
< |
Object[] o = q.toArray(); |
479 |
< |
for (int i = 0; i < o.length; i++) { |
480 |
< |
assertSame(o[i], q.poll()); |
481 |
< |
} |
478 |
> |
Object[] a = q.toArray(); |
479 |
> |
assertSame(Object[].class, a.getClass()); |
480 |
> |
for (Object o : a) |
481 |
> |
assertSame(o, q.poll()); |
482 |
> |
assertTrue(q.isEmpty()); |
483 |
|
} |
484 |
|
|
485 |
|
/** |
490 |
|
Integer[] ints = new Integer[SIZE]; |
491 |
|
Integer[] array = q.toArray(ints); |
492 |
|
assertSame(ints, array); |
493 |
< |
for (int i = 0; i < ints.length; i++) { |
494 |
< |
assertSame(ints[i], q.poll()); |
495 |
< |
} |
493 |
> |
for (Integer o : ints) |
494 |
> |
assertSame(o, q.poll()); |
495 |
> |
assertTrue(q.isEmpty()); |
496 |
|
} |
497 |
|
|
498 |
|
/** |
648 |
|
} |
649 |
|
|
650 |
|
/** |
651 |
< |
* A deserialized serialized queue has same elements in same order |
651 |
> |
* A deserialized/reserialized queue has same elements in same order |
652 |
|
*/ |
653 |
|
public void testSerialization() throws Exception { |
654 |
|
Queue x = populatedQueue(SIZE); |
775 |
|
} |
776 |
|
|
777 |
|
/** |
778 |
< |
* transfer waits until a poll occurs. The transfered element |
778 |
> |
* transfer waits until a poll occurs. The transferred element |
779 |
|
* is returned by the associated poll. |
780 |
|
*/ |
781 |
|
public void testTransfer2() throws InterruptedException { |
856 |
|
} |
857 |
|
|
858 |
|
/** |
859 |
< |
* transfer waits until a take occurs. The transfered element |
859 |
> |
* transfer waits until a take occurs. The transferred element |
860 |
|
* is returned by the associated take. |
861 |
|
*/ |
862 |
|
public void testTransfer5() throws InterruptedException { |