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

Comparing jsr166/src/test/tck/ConcurrentLinkedQueueTest.java (file contents):
Revision 1.34 by jsr166, Wed Dec 31 20:17:39 2014 UTC vs.
Revision 1.37 by jsr166, Sat Apr 25 04:55:30 2015 UTC

# Line 19 | Line 19 | import junit.framework.TestSuite;
19   public class ConcurrentLinkedQueueTest extends JSR166TestCase {
20  
21      public static void main(String[] args) {
22 <        junit.textui.TestRunner.run(suite());
22 >        main(suite(), args);
23      }
24  
25      public static Test suite() {
# Line 52 | Line 52 | public class ConcurrentLinkedQueueTest e
52       */
53      public void testConstructor3() {
54          try {
55 <            ConcurrentLinkedQueue q = new ConcurrentLinkedQueue((Collection)null);
55 >            new ConcurrentLinkedQueue((Collection)null);
56              shouldThrow();
57          } catch (NullPointerException success) {}
58      }
# Line 63 | Line 63 | public class ConcurrentLinkedQueueTest e
63      public void testConstructor4() {
64          try {
65              Integer[] ints = new Integer[SIZE];
66 <            ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(Arrays.asList(ints));
66 >            new ConcurrentLinkedQueue(Arrays.asList(ints));
67              shouldThrow();
68          } catch (NullPointerException success) {}
69      }
# Line 76 | Line 76 | public class ConcurrentLinkedQueueTest e
76              Integer[] ints = new Integer[SIZE];
77              for (int i = 0; i < SIZE-1; ++i)
78                  ints[i] = new Integer(i);
79 <            ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(Arrays.asList(ints));
79 >            new ConcurrentLinkedQueue(Arrays.asList(ints));
80              shouldThrow();
81          } catch (NullPointerException success) {}
82      }
# Line 427 | Line 427 | public class ConcurrentLinkedQueueTest e
427       */
428      public void testIterator() {
429          ConcurrentLinkedQueue q = populatedQueue(SIZE);
430        int i = 0;
430          Iterator it = q.iterator();
431 <        while (it.hasNext()) {
431 >        int i;
432 >        for (i = 0; it.hasNext(); i++)
433              assertTrue(q.contains(it.next()));
434            ++i;
435        }
434          assertEquals(i, SIZE);
435 +        assertIteratorExhausted(it);
436 +    }
437 +
438 +    /**
439 +     * iterator of empty collection has no elements
440 +     */
441 +    public void testEmptyIterator() {
442 +        assertIteratorExhausted(new ConcurrentLinkedQueue().iterator());
443      }
444  
445      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines