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

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

# Line 64 | Line 64 | public class PriorityBlockingQueueTest e
64          PriorityBlockingQueue<Integer> q =
65              new PriorityBlockingQueue<Integer>(n);
66          assertTrue(q.isEmpty());
67 <        for (int i = n-1; i >= 0; i-=2)
67 >        for (int i = n-1; i >= 0; i -= 2)
68              assertTrue(q.offer(new Integer(i)));
69 <        for (int i = (n & 1); i < n; i+=2)
69 >        for (int i = (n & 1); i < n; i += 2)
70              assertTrue(q.offer(new Integer(i)));
71          assertFalse(q.isEmpty());
72          assertEquals(NOCAP, q.remainingCapacity());
# Line 266 | Line 266 | public class PriorityBlockingQueueTest e
266      public void testPut() {
267          PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE);
268          for (int i = 0; i < SIZE; ++i) {
269 <            Integer I = new Integer(i);
270 <            q.put(I);
271 <            assertTrue(q.contains(I));
269 >            Integer x = new Integer(i);
270 >            q.put(x);
271 >            assertTrue(q.contains(x));
272          }
273          assertEquals(SIZE, q.size());
274      }
# Line 530 | Line 530 | public class PriorityBlockingQueueTest e
530              assertTrue(q.removeAll(p));
531              assertEquals(SIZE-i, q.size());
532              for (int j = 0; j < i; ++j) {
533 <                Integer I = (Integer)(p.remove());
534 <                assertFalse(q.contains(I));
533 >                Integer x = (Integer)(p.remove());
534 >                assertFalse(q.contains(x));
535              }
536          }
537      }
# Line 576 | Line 576 | public class PriorityBlockingQueueTest e
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      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines