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

Comparing jsr166/src/test/tck/TreeSetTest.java (file contents):
Revision 1.32 by jsr166, Wed Dec 31 20:17:40 2014 UTC vs.
Revision 1.35 by jsr166, Sun Feb 22 04:34:44 2015 UTC

# Line 81 | Line 81 | public class TreeSetTest extends JSR166T
81       */
82      public void testConstructor3() {
83          try {
84 <            TreeSet q = new TreeSet((Collection)null);
84 >            new TreeSet((Collection)null);
85              shouldThrow();
86          } catch (NullPointerException success) {}
87      }
# Line 92 | Line 92 | public class TreeSetTest extends JSR166T
92      public void testConstructor4() {
93          try {
94              Integer[] ints = new Integer[SIZE];
95 <            TreeSet q = new TreeSet(Arrays.asList(ints));
95 >            new TreeSet(Arrays.asList(ints));
96              shouldThrow();
97          } catch (NullPointerException success) {}
98      }
# Line 105 | Line 105 | public class TreeSetTest extends JSR166T
105              Integer[] ints = new Integer[SIZE];
106              for (int i = 0; i < SIZE-1; ++i)
107                  ints[i] = new Integer(i);
108 <            TreeSet q = new TreeSet(Arrays.asList(ints));
108 >            new TreeSet(Arrays.asList(ints));
109              shouldThrow();
110          } catch (NullPointerException success) {}
111      }
# Line 478 | Line 478 | public class TreeSetTest extends JSR166T
478       */
479      public void testIterator() {
480          TreeSet q = populatedSet(SIZE);
481        int i = 0;
481          Iterator it = q.iterator();
482 <        while (it.hasNext()) {
482 >        int i;
483 >        for (i = 0; it.hasNext(); i++)
484              assertTrue(q.contains(it.next()));
485            ++i;
486        }
485          assertEquals(i, SIZE);
486 +        assertIteratorExhausted(it);
487      }
488  
489      /**
490       * iterator of empty set has no elements
491       */
492      public void testEmptyIterator() {
493 <        TreeSet q = new TreeSet();
495 <        int i = 0;
496 <        Iterator it = q.iterator();
497 <        while (it.hasNext()) {
498 <            assertTrue(q.contains(it.next()));
499 <            ++i;
500 <        }
501 <        assertEquals(0, i);
493 >        assertIteratorExhausted(new TreeSet().iterator());
494      }
495  
496      /**
# Line 738 | Line 730 | public class TreeSetTest extends JSR166T
730          // Add entries till we're back to original size
731          while (set.size() < size) {
732              int element = min + rnd.nextInt(rangeSize);
733 <            assertTrue(element >= min && element<= max);
733 >            assertTrue(element >= min && element <= max);
734              put(set, element);
735          }
736      }
# Line 763 | Line 755 | public class TreeSetTest extends JSR166T
755          // Add entries till we're back to original size
756          while (set.size() < size) {
757              int element = min - 5 + rnd.nextInt(rangeSize + 10);
758 <            if (element >= min && element<= max) {
758 >            if (element >= min && element <= max) {
759                  put(set, element);
760              } else {
761                  try {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines