576 |
|
*/ |
577 |
|
public void testIterator() { |
578 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
579 |
– |
int i = 0; |
579 |
|
Iterator it = q.iterator(); |
580 |
< |
while (it.hasNext()) { |
580 |
> |
int i; |
581 |
> |
for (i = 0; it.hasNext(); i++) |
582 |
|
assertTrue(q.contains(it.next())); |
583 |
– |
++i; |
584 |
– |
} |
583 |
|
assertEquals(i, SIZE); |
584 |
+ |
assertIteratorExhausted(it); |
585 |
+ |
} |
586 |
+ |
|
587 |
+ |
/** |
588 |
+ |
* iterator of empty collection has no elements |
589 |
+ |
*/ |
590 |
+ |
public void testEmptyIterator() { |
591 |
+ |
assertIteratorExhausted(new PriorityBlockingQueue().iterator()); |
592 |
|
} |
593 |
|
|
594 |
|
/** |