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.15 by jsr166, Thu Nov 4 01:04:54 2010 UTC vs.
Revision 1.17 by jsr166, Thu Nov 18 20:21:53 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 238 | Line 239 | public class ConcurrentSkipListSubSetTes
239      public void testRemoveElement() {
240          NavigableSet q = populatedSet(SIZE);
241          for (int i = 1; i < SIZE; i+=2) {
242 <            assertTrue(q.remove(new Integer(i)));
242 >            assertTrue(q.contains(i));
243 >            assertTrue(q.remove(i));
244 >            assertFalse(q.contains(i));
245 >            assertTrue(q.contains(i-1));
246          }
247          for (int i = 0; i < SIZE; i+=2) {
248 <            assertTrue(q.remove(new Integer(i)));
249 <            assertFalse(q.remove(new Integer(i+1)));
248 >            assertTrue(q.contains(i));
249 >            assertTrue(q.remove(i));
250 >            assertFalse(q.contains(i));
251 >            assertFalse(q.remove(i+1));
252 >            assertFalse(q.contains(i+1));
253          }
254          assertTrue(q.isEmpty());
255      }
# Line 410 | Line 417 | public class ConcurrentSkipListSubSetTes
417       * toArray(a) contains all elements in sorted order
418       */
419      public void testToArray2() {
420 <        NavigableSet q = populatedSet(SIZE);
420 >        NavigableSet<Integer> q = populatedSet(SIZE);
421          Integer[] ints = new Integer[SIZE];
422 <        assertSame(ints, q.toArray(ints));
422 >        Integer[] array = q.toArray(ints);
423 >        assertSame(ints, array);
424          for (int i = 0; i < ints.length; i++)
425              assertSame(ints[i], q.pollFirst());
426      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines