87 |
|
*/ |
88 |
|
public void testConstructor4() { |
89 |
|
try { |
90 |
< |
Integer[] ints = new Integer[SIZE]; |
91 |
< |
new ConcurrentSkipListSet(Arrays.asList(ints)); |
90 |
> |
new ConcurrentSkipListSet(Arrays.asList(new Integer[SIZE])); |
91 |
|
shouldThrow(); |
92 |
|
} catch (NullPointerException success) {} |
93 |
|
} |
96 |
|
* Initializing from Collection with some null elements throws NPE |
97 |
|
*/ |
98 |
|
public void testConstructor5() { |
99 |
+ |
Integer[] ints = new Integer[SIZE]; |
100 |
+ |
for (int i = 0; i < SIZE - 1; ++i) |
101 |
+ |
ints[i] = new Integer(i); |
102 |
|
try { |
101 |
– |
Integer[] ints = new Integer[SIZE]; |
102 |
– |
for (int i = 0; i < SIZE-1; ++i) |
103 |
– |
ints[i] = new Integer(i); |
103 |
|
new ConcurrentSkipListSet(Arrays.asList(ints)); |
104 |
|
shouldThrow(); |
105 |
|
} catch (NullPointerException success) {} |
128 |
|
for (int i = 0; i < SIZE; ++i) |
129 |
|
ints[i] = new Integer(i); |
130 |
|
q.addAll(Arrays.asList(ints)); |
131 |
< |
for (int i = SIZE-1; i >= 0; --i) |
131 |
> |
for (int i = SIZE - 1; i >= 0; --i) |
132 |
|
assertEquals(ints[i], q.pollFirst()); |
133 |
|
} |
134 |
|
|
152 |
|
public void testSize() { |
153 |
|
ConcurrentSkipListSet q = populatedSet(SIZE); |
154 |
|
for (int i = 0; i < SIZE; ++i) { |
155 |
< |
assertEquals(SIZE-i, q.size()); |
155 |
> |
assertEquals(SIZE - i, q.size()); |
156 |
|
q.pollFirst(); |
157 |
|
} |
158 |
|
for (int i = 0; i < SIZE; ++i) { |
232 |
|
public void testAddAll3() { |
233 |
|
ConcurrentSkipListSet q = new ConcurrentSkipListSet(); |
234 |
|
Integer[] ints = new Integer[SIZE]; |
235 |
< |
for (int i = 0; i < SIZE-1; ++i) |
235 |
> |
for (int i = 0; i < SIZE - 1; ++i) |
236 |
|
ints[i] = new Integer(i); |
237 |
|
try { |
238 |
|
q.addAll(Arrays.asList(ints)); |
247 |
|
Integer[] empty = new Integer[0]; |
248 |
|
Integer[] ints = new Integer[SIZE]; |
249 |
|
for (int i = 0; i < SIZE; ++i) |
250 |
< |
ints[i] = new Integer(SIZE-1-i); |
250 |
> |
ints[i] = new Integer(SIZE - 1 - i); |
251 |
|
ConcurrentSkipListSet q = new ConcurrentSkipListSet(); |
252 |
|
assertFalse(q.addAll(Arrays.asList(empty))); |
253 |
|
assertTrue(q.addAll(Arrays.asList(ints))); |
271 |
|
*/ |
272 |
|
public void testPollLast() { |
273 |
|
ConcurrentSkipListSet q = populatedSet(SIZE); |
274 |
< |
for (int i = SIZE-1; i >= 0; --i) { |
274 |
> |
for (int i = SIZE - 1; i >= 0; --i) { |
275 |
|
assertEquals(i, q.pollLast()); |
276 |
|
} |
277 |
|
assertNull(q.pollFirst()); |
352 |
|
assertTrue(changed); |
353 |
|
|
354 |
|
assertTrue(q.containsAll(p)); |
355 |
< |
assertEquals(SIZE-i, q.size()); |
355 |
> |
assertEquals(SIZE - i, q.size()); |
356 |
|
p.pollFirst(); |
357 |
|
} |
358 |
|
} |
365 |
|
ConcurrentSkipListSet q = populatedSet(SIZE); |
366 |
|
ConcurrentSkipListSet p = populatedSet(i); |
367 |
|
assertTrue(q.removeAll(p)); |
368 |
< |
assertEquals(SIZE-i, q.size()); |
368 |
> |
assertEquals(SIZE - i, q.size()); |
369 |
|
for (int j = 0; j < i; ++j) { |
370 |
|
Integer x = (Integer)(p.pollFirst()); |
371 |
|
assertFalse(q.contains(x)); |