ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/LinkedBlockingQueueTest.java
(Generate patch)

Comparing jsr166/src/test/tck/LinkedBlockingQueueTest.java (file contents):
Revision 1.56 by jsr166, Wed Dec 31 20:17:39 2014 UTC vs.
Revision 1.57 by jsr166, Sat Jan 17 22:55:06 2015 UTC

# Line 634 | Line 634 | public class LinkedBlockingQueueTest ext
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      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines