14 |
|
public class ConcurrentLinkedQueueTest extends JSR166TestCase { |
15 |
|
|
16 |
|
public static void main(String[] args) { |
17 |
< |
junit.textui.TestRunner.run (suite()); |
17 |
> |
junit.textui.TestRunner.run(suite()); |
18 |
|
} |
19 |
|
|
20 |
|
public static Test suite() { |
43 |
|
} |
44 |
|
|
45 |
|
/** |
46 |
< |
* Initializing from null Collection throws NPE |
46 |
> |
* Initializing from null Collection throws NPE |
47 |
|
*/ |
48 |
|
public void testConstructor3() { |
49 |
|
try { |
193 |
|
shouldThrow(); |
194 |
|
} catch (NullPointerException success) {} |
195 |
|
} |
196 |
+ |
|
197 |
|
/** |
198 |
< |
* addAll of a collection with any null elements throws NPE after |
198 |
> |
* addAll of a collection with any null elements throws NPE after |
199 |
|
* possibly adding some elements |
200 |
|
*/ |
201 |
|
public void testAddAll3() { |
265 |
|
} |
266 |
|
|
267 |
|
/** |
268 |
< |
* remove removes next element, or throws NSEE if empty |
268 |
> |
* remove removes next element, or throws NSEE if empty |
269 |
|
*/ |
270 |
|
public void testRemove() { |
271 |
|
ConcurrentLinkedQueue q = populatedQueue(SIZE); |
380 |
|
} |
381 |
|
|
382 |
|
/** |
383 |
< |
* toArray(a) contains all elements |
383 |
> |
* toArray(a) contains all elements |
384 |
|
*/ |
385 |
|
public void testToArray2() { |
386 |
|
ConcurrentLinkedQueue q = populatedQueue(SIZE); |
392 |
|
} |
393 |
|
|
394 |
|
/** |
395 |
< |
* toArray(null) throws NPE |
395 |
> |
* toArray(null) throws NullPointerException |
396 |
|
*/ |
397 |
< |
public void testToArray_BadArg() { |
397 |
> |
public void testToArray_NullArg() { |
398 |
|
ConcurrentLinkedQueue q = populatedQueue(SIZE); |
399 |
|
try { |
400 |
< |
Object o[] = q.toArray(null); |
400 |
> |
q.toArray(null); |
401 |
|
shouldThrow(); |
402 |
|
} catch (NullPointerException success) {} |
403 |
|
} |
404 |
|
|
405 |
|
/** |
406 |
< |
* toArray with incompatible array type throws ArrayStoreException |
406 |
> |
* toArray(incompatible array type) throws ArrayStoreException |
407 |
|
*/ |
408 |
|
public void testToArray1_BadArg() { |
409 |
|
ConcurrentLinkedQueue q = populatedQueue(SIZE); |
410 |
|
try { |
411 |
< |
Object o[] = q.toArray(new String[10]); |
411 |
> |
q.toArray(new String[10]); |
412 |
|
shouldThrow(); |
413 |
|
} catch (ArrayStoreException success) {} |
414 |
|
} |
415 |
|
|
416 |
|
/** |
417 |
< |
* iterator iterates through all elements |
417 |
> |
* iterator iterates through all elements |
418 |
|
*/ |
419 |
|
public void testIterator() { |
420 |
|
ConcurrentLinkedQueue q = populatedQueue(SIZE); |
447 |
|
/** |
448 |
|
* Modifications do not cause iterators to fail |
449 |
|
*/ |
450 |
< |
public void testWeaklyConsistentIteration () { |
450 |
> |
public void testWeaklyConsistentIteration() { |
451 |
|
final ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); |
452 |
|
q.add(one); |
453 |
|
q.add(two); |
464 |
|
/** |
465 |
|
* iterator.remove removes current element |
466 |
|
*/ |
467 |
< |
public void testIteratorRemove () { |
467 |
> |
public void testIteratorRemove() { |
468 |
|
final ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(); |
469 |
|
q.add(one); |
470 |
|
q.add(two); |