11 |
|
|
12 |
|
public class ConcurrentSkipListSubSetTest extends JSR166TestCase { |
13 |
|
public static void main(String[] args) { |
14 |
< |
junit.textui.TestRunner.run (suite()); |
14 |
> |
junit.textui.TestRunner.run(suite()); |
15 |
|
} |
16 |
|
public static Test suite() { |
17 |
|
return new TestSuite(ConcurrentSkipListSubSetTest.class); |
19 |
|
|
20 |
|
static class MyReverseComparator implements Comparator { |
21 |
|
public int compare(Object x, Object y) { |
22 |
< |
int i = ((Integer)x).intValue(); |
23 |
< |
int j = ((Integer)y).intValue(); |
24 |
< |
if (i < j) return 1; |
25 |
< |
if (i > j) return -1; |
26 |
< |
return 0; |
22 |
> |
return ((Comparable)y).compareTo(x); |
23 |
|
} |
24 |
|
} |
25 |
|
|
178 |
|
shouldThrow(); |
179 |
|
} catch (NullPointerException success) {} |
180 |
|
} |
181 |
+ |
|
182 |
|
/** |
183 |
|
* addAll of a collection with null elements throws NPE |
184 |
|
*/ |
190 |
|
shouldThrow(); |
191 |
|
} catch (NullPointerException success) {} |
192 |
|
} |
193 |
+ |
|
194 |
|
/** |
195 |
|
* addAll of a collection with any null elements throws NPE after |
196 |
|
* possibly adding some elements |
227 |
|
public void testPoll() { |
228 |
|
NavigableSet q = populatedSet(SIZE); |
229 |
|
for (int i = 0; i < SIZE; ++i) { |
230 |
< |
assertEquals(i, ((Integer)q.pollFirst()).intValue()); |
230 |
> |
assertEquals(i, q.pollFirst()); |
231 |
|
} |
232 |
|
assertNull(q.pollFirst()); |
233 |
|
} |
340 |
|
|
341 |
|
Object e4 = q.lower(zero); |
342 |
|
assertNull(e4); |
345 |
– |
|
343 |
|
} |
344 |
|
|
345 |
|
/** |
358 |
|
|
359 |
|
Object e4 = q.higher(six); |
360 |
|
assertNull(e4); |
364 |
– |
|
361 |
|
} |
362 |
|
|
363 |
|
/** |
376 |
|
|
377 |
|
Object e4 = q.floor(zero); |
378 |
|
assertNull(e4); |
383 |
– |
|
379 |
|
} |
380 |
|
|
381 |
|
/** |
394 |
|
|
395 |
|
Object e4 = q.ceiling(six); |
396 |
|
assertNull(e4); |
402 |
– |
|
397 |
|
} |
398 |
|
|
399 |
|
/** |
450 |
|
/** |
451 |
|
* iterator.remove removes current element |
452 |
|
*/ |
453 |
< |
public void testIteratorRemove () { |
453 |
> |
public void testIteratorRemove() { |
454 |
|
final NavigableSet q = set0(); |
455 |
|
q.add(new Integer(2)); |
456 |
|
q.add(new Integer(1)); |
682 |
|
shouldThrow(); |
683 |
|
} catch (NullPointerException success) {} |
684 |
|
} |
685 |
+ |
|
686 |
|
/** |
687 |
|
* addAll of a collection with null elements throws NPE |
688 |
|
*/ |
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 |
731 |
|
public void testDescendingPoll() { |
732 |
|
NavigableSet q = populatedSet(SIZE); |
733 |
|
for (int i = 0; i < SIZE; ++i) { |
734 |
< |
assertEquals(i, ((Integer)q.pollFirst()).intValue()); |
734 |
> |
assertEquals(i, q.pollFirst()); |
735 |
|
} |
736 |
|
assertNull(q.pollFirst()); |
737 |
|
} |
844 |
|
|
845 |
|
Object e4 = q.lower(zero); |
846 |
|
assertNull(e4); |
851 |
– |
|
847 |
|
} |
848 |
|
|
849 |
|
/** |
862 |
|
|
863 |
|
Object e4 = q.higher(m6); |
864 |
|
assertNull(e4); |
870 |
– |
|
865 |
|
} |
866 |
|
|
867 |
|
/** |
880 |
|
|
881 |
|
Object e4 = q.floor(zero); |
882 |
|
assertNull(e4); |
889 |
– |
|
883 |
|
} |
884 |
|
|
885 |
|
/** |
898 |
|
|
899 |
|
Object e4 = q.ceiling(m6); |
900 |
|
assertNull(e4); |
908 |
– |
|
901 |
|
} |
902 |
|
|
903 |
|
/** |
954 |
|
/** |
955 |
|
* iterator.remove removes current element |
956 |
|
*/ |
957 |
< |
public void testDescendingIteratorRemove () { |
957 |
> |
public void testDescendingIteratorRemove() { |
958 |
|
final NavigableSet q = dset0(); |
959 |
|
q.add(new Integer(2)); |
960 |
|
q.add(new Integer(1)); |