634 |
|
public void testIterator() throws InterruptedException { |
635 |
|
LinkedBlockingQueue q = populatedQueue(SIZE); |
636 |
|
Iterator it = q.iterator(); |
637 |
< |
while (it.hasNext()) { |
637 |
> |
int i; |
638 |
> |
for (i = 0; it.hasNext(); i++) |
639 |
> |
assertTrue(q.contains(it.next())); |
640 |
> |
assertEquals(i, SIZE); |
641 |
> |
assertIteratorExhausted(it); |
642 |
> |
|
643 |
> |
it = q.iterator(); |
644 |
> |
for (i = 0; it.hasNext(); i++) |
645 |
|
assertEquals(it.next(), q.take()); |
646 |
< |
} |
646 |
> |
assertEquals(i, SIZE); |
647 |
> |
assertIteratorExhausted(it); |
648 |
> |
} |
649 |
> |
|
650 |
> |
/** |
651 |
> |
* iterator of empty collection has no elements |
652 |
> |
*/ |
653 |
> |
public void testEmptyIterator() { |
654 |
> |
assertIteratorExhausted(new LinkedBlockingQueue().iterator()); |
655 |
|
} |
656 |
|
|
657 |
|
/** |