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

Comparing jsr166/src/test/tck/ConcurrentSkipListSubSetTest.java (file contents):
Revision 1.13 by jsr166, Wed Aug 25 00:07:03 2010 UTC vs.
Revision 1.16 by jsr166, Fri Nov 5 00:17:22 2010 UTC

# Line 27 | Line 27 | public class ConcurrentSkipListSubSetTes
27       * Create a set of given size containing consecutive
28       * Integers 0 ... n.
29       */
30 <    private NavigableSet populatedSet(int n) {
31 <        ConcurrentSkipListSet q = new ConcurrentSkipListSet();
30 >    private NavigableSet<Integer> populatedSet(int n) {
31 >        ConcurrentSkipListSet<Integer> q =
32 >            new ConcurrentSkipListSet<Integer>();
33          assertTrue(q.isEmpty());
34  
35          for (int i = n-1; i >= 0; i-=2)
# Line 178 | Line 179 | public class ConcurrentSkipListSubSetTes
179              shouldThrow();
180          } catch (NullPointerException success) {}
181      }
182 +
183      /**
184       * addAll of a collection with null elements throws NPE
185       */
# Line 189 | Line 191 | public class ConcurrentSkipListSubSetTes
191              shouldThrow();
192          } catch (NullPointerException success) {}
193      }
194 +
195      /**
196       * addAll of a collection with any null elements throws NPE after
197       * possibly adding some elements
# Line 395 | Line 398 | public class ConcurrentSkipListSubSetTes
398      }
399  
400      /**
401 <     * toArray contains all elements
401 >     * toArray contains all elements in sorted order
402       */
403      public void testToArray() {
404          NavigableSet q = populatedSet(SIZE);
405          Object[] o = q.toArray();
403        Arrays.sort(o);
406          for (int i = 0; i < o.length; i++)
407 <            assertEquals(o[i], q.pollFirst());
407 >            assertSame(o[i], q.pollFirst());
408      }
409  
410      /**
411 <     * toArray(a) contains all elements
411 >     * toArray(a) contains all elements in sorted order
412       */
413      public void testToArray2() {
414 <        NavigableSet q = populatedSet(SIZE);
414 >        NavigableSet<Integer> q = populatedSet(SIZE);
415          Integer[] ints = new Integer[SIZE];
416 <        ints = (Integer[])q.toArray(ints);
417 <        Arrays.sort(ints);
416 >        Integer[] array = q.toArray(ints);
417 >        assertSame(ints, array);
418          for (int i = 0; i < ints.length; i++)
419 <            assertEquals(ints[i], q.pollFirst());
419 >            assertSame(ints[i], q.pollFirst());
420      }
421  
422      /**
# Line 680 | Line 682 | public class ConcurrentSkipListSubSetTes
682              shouldThrow();
683          } catch (NullPointerException success) {}
684      }
685 +
686      /**
687       * addAll of a collection with null elements throws NPE
688       */
# Line 691 | Line 694 | public class ConcurrentSkipListSubSetTes
694              shouldThrow();
695          } catch (NullPointerException success) {}
696      }
697 +
698      /**
699       * addAll of a collection with any null elements throws NPE after
700       * possibly adding some elements
# Line 913 | Line 917 | public class ConcurrentSkipListSubSetTes
917      public void testDescendingToArray2() {
918          NavigableSet q = populatedSet(SIZE);
919          Integer[] ints = new Integer[SIZE];
920 <        ints = (Integer[])q.toArray(ints);
920 >        assertSame(ints, q.toArray(ints));
921          Arrays.sort(ints);
922          for (int i = 0; i < ints.length; i++)
923              assertEquals(ints[i], q.pollFirst());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines