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

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

# Line 1518 | Line 1518 | public class LinkedBlockingDequeTest ext
1518      public void testIterator() throws InterruptedException {
1519          LinkedBlockingDeque q = populatedDeque(SIZE);
1520          Iterator it = q.iterator();
1521 <        while (it.hasNext()) {
1521 >        int i;
1522 >        for (i = 0; it.hasNext(); i++)
1523 >            assertTrue(q.contains(it.next()));
1524 >        assertEquals(i, SIZE);
1525 >        assertIteratorExhausted(it);
1526 >
1527 >        it = q.iterator();
1528 >        for (i = 0; it.hasNext(); i++)
1529              assertEquals(it.next(), q.take());
1530 <        }
1530 >        assertEquals(i, SIZE);
1531 >        assertIteratorExhausted(it);
1532 >    }
1533 >
1534 >    /**
1535 >     * iterator of empty collection has no elements
1536 >     */
1537 >    public void testEmptyIterator() {
1538 >        Deque c = new LinkedBlockingDeque();
1539 >        assertIteratorExhausted(c.iterator());
1540 >        assertIteratorExhausted(c.descendingIterator());
1541      }
1542  
1543      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines