193 |
|
*/ |
194 |
|
public void testGet() { |
195 |
|
CopyOnWriteArrayList full = populatedArray(3); |
196 |
< |
assertEquals(0, ((Integer)full.get(0)).intValue()); |
196 |
> |
assertEquals(0, full.get(0)); |
197 |
|
} |
198 |
|
|
199 |
|
/** |
233 |
|
Iterator i = full.iterator(); |
234 |
|
int j; |
235 |
|
for (j = 0; i.hasNext(); j++) |
236 |
< |
assertEquals(j, ((Integer)i.next()).intValue()); |
236 |
> |
assertEquals(j, i.next()); |
237 |
|
assertEquals(SIZE, j); |
238 |
|
} |
239 |
|
|
291 |
|
ListIterator i = full.listIterator(); |
292 |
|
int j; |
293 |
|
for (j = 0; i.hasNext(); j++) |
294 |
< |
assertEquals(j, ((Integer)i.next()).intValue()); |
294 |
> |
assertEquals(j, i.next()); |
295 |
|
assertEquals(SIZE, j); |
296 |
|
} |
297 |
|
|
303 |
|
ListIterator i = full.listIterator(1); |
304 |
|
int j; |
305 |
|
for (j = 0; i.hasNext(); j++) |
306 |
< |
assertEquals(j+1, ((Integer)i.next()).intValue()); |
306 |
> |
assertEquals(j+1, i.next()); |
307 |
|
assertEquals(2, j); |
308 |
|
} |
309 |
|
|
312 |
|
*/ |
313 |
|
public void testRemove() { |
314 |
|
CopyOnWriteArrayList full = populatedArray(3); |
315 |
< |
assertEquals(two, full.remove(2)); |
315 |
> |
assertEquals(2, full.remove(2)); |
316 |
|
assertEquals(2, full.size()); |
317 |
|
} |
318 |
|
|
333 |
|
*/ |
334 |
|
public void testSet() { |
335 |
|
CopyOnWriteArrayList full = populatedArray(3); |
336 |
< |
assertEquals(two, full.set(2, four)); |
337 |
< |
assertEquals(4, ((Integer)full.get(2)).intValue()); |
336 |
> |
assertEquals(2, full.set(2, four)); |
337 |
> |
assertEquals(4, full.get(2)); |
338 |
|
} |
339 |
|
|
340 |
|
/** |
354 |
|
CopyOnWriteArrayList full = populatedArray(3); |
355 |
|
Object[] o = full.toArray(); |
356 |
|
assertEquals(3, o.length); |
357 |
< |
assertEquals(0, ((Integer)o[0]).intValue()); |
358 |
< |
assertEquals(1, ((Integer)o[1]).intValue()); |
359 |
< |
assertEquals(2, ((Integer)o[2]).intValue()); |
357 |
> |
assertEquals(0, o[0]); |
358 |
> |
assertEquals(1, o[1]); |
359 |
> |
assertEquals(2, o[2]); |
360 |
|
} |
361 |
|
|
362 |
|
/** |
410 |
|
c.add("asdadasd"); |
411 |
|
c.toArray(new Long[5]); |
412 |
|
shouldThrow(); |
413 |
< |
} catch (ArrayStoreException e) {} |
413 |
> |
} catch (ArrayStoreException success) {} |
414 |
|
} |
415 |
|
|
416 |
|
/** |
421 |
|
CopyOnWriteArrayList c = new CopyOnWriteArrayList(); |
422 |
|
c.get(-1); |
423 |
|
shouldThrow(); |
424 |
< |
} catch (IndexOutOfBoundsException e) {} |
424 |
> |
} catch (IndexOutOfBoundsException success) {} |
425 |
|
} |
426 |
|
|
427 |
|
/** |
434 |
|
c.add("asdad"); |
435 |
|
c.get(100); |
436 |
|
shouldThrow(); |
437 |
< |
} catch (IndexOutOfBoundsException e) {} |
437 |
> |
} catch (IndexOutOfBoundsException success) {} |
438 |
|
} |
439 |
|
|
440 |
|
/** |
445 |
|
CopyOnWriteArrayList c = new CopyOnWriteArrayList(); |
446 |
|
c.set(-1,"qwerty"); |
447 |
|
shouldThrow(); |
448 |
< |
} catch (IndexOutOfBoundsException e) {} |
448 |
> |
} catch (IndexOutOfBoundsException success) {} |
449 |
|
} |
450 |
|
|
451 |
|
/** |
458 |
|
c.add("asdad"); |
459 |
|
c.set(100, "qwerty"); |
460 |
|
shouldThrow(); |
461 |
< |
} catch (IndexOutOfBoundsException e) {} |
461 |
> |
} catch (IndexOutOfBoundsException success) {} |
462 |
|
} |
463 |
|
|
464 |
|
/** |
469 |
|
CopyOnWriteArrayList c = new CopyOnWriteArrayList(); |
470 |
|
c.add(-1,"qwerty"); |
471 |
|
shouldThrow(); |
472 |
< |
} catch (IndexOutOfBoundsException e) {} |
472 |
> |
} catch (IndexOutOfBoundsException success) {} |
473 |
|
} |
474 |
|
|
475 |
|
/** |
482 |
|
c.add("asdasdasd"); |
483 |
|
c.add(100, "qwerty"); |
484 |
|
shouldThrow(); |
485 |
< |
} catch (IndexOutOfBoundsException e) {} |
485 |
> |
} catch (IndexOutOfBoundsException success) {} |
486 |
|
} |
487 |
|
|
488 |
|
/** |
493 |
|
CopyOnWriteArrayList c = new CopyOnWriteArrayList(); |
494 |
|
c.remove(-1); |
495 |
|
shouldThrow(); |
496 |
< |
} catch (IndexOutOfBoundsException e) {} |
496 |
> |
} catch (IndexOutOfBoundsException success) {} |
497 |
|
} |
498 |
|
|
499 |
|
/** |
506 |
|
c.add("adasdasd"); |
507 |
|
c.remove(100); |
508 |
|
shouldThrow(); |
509 |
< |
} catch (IndexOutOfBoundsException e) {} |
509 |
> |
} catch (IndexOutOfBoundsException success) {} |
510 |
|
} |
511 |
|
|
512 |
|
/** |
517 |
|
CopyOnWriteArrayList c = new CopyOnWriteArrayList(); |
518 |
|
c.addAll(-1,new LinkedList()); |
519 |
|
shouldThrow(); |
520 |
< |
} catch (IndexOutOfBoundsException e) {} |
520 |
> |
} catch (IndexOutOfBoundsException success) {} |
521 |
|
} |
522 |
|
|
523 |
|
/** |
530 |
|
c.add("asdasdasd"); |
531 |
|
c.addAll(100, new LinkedList()); |
532 |
|
shouldThrow(); |
533 |
< |
} catch (IndexOutOfBoundsException e) {} |
533 |
> |
} catch (IndexOutOfBoundsException success) {} |
534 |
|
} |
535 |
|
|
536 |
|
/** |
541 |
|
CopyOnWriteArrayList c = new CopyOnWriteArrayList(); |
542 |
|
c.listIterator(-1); |
543 |
|
shouldThrow(); |
544 |
< |
} catch (IndexOutOfBoundsException e) {} |
544 |
> |
} catch (IndexOutOfBoundsException success) {} |
545 |
|
} |
546 |
|
|
547 |
|
/** |
554 |
|
c.add("asdasdas"); |
555 |
|
c.listIterator(100); |
556 |
|
shouldThrow(); |
557 |
< |
} catch (IndexOutOfBoundsException e) {} |
557 |
> |
} catch (IndexOutOfBoundsException success) {} |
558 |
|
} |
559 |
|
|
560 |
|
/** |
564 |
|
try { |
565 |
|
CopyOnWriteArrayList c = new CopyOnWriteArrayList(); |
566 |
|
c.subList(-1,100); |
567 |
– |
|
567 |
|
shouldThrow(); |
568 |
< |
} catch (IndexOutOfBoundsException e) {} |
568 |
> |
} catch (IndexOutOfBoundsException success) {} |
569 |
|
} |
570 |
|
|
571 |
|
/** |
577 |
|
c.add("asdasd"); |
578 |
|
c.subList(1,100); |
579 |
|
shouldThrow(); |
580 |
< |
} catch (IndexOutOfBoundsException e) {} |
580 |
> |
} catch (IndexOutOfBoundsException success) {} |
581 |
|
} |
582 |
|
|
583 |
|
/** |
588 |
|
try { |
589 |
|
CopyOnWriteArrayList c = new CopyOnWriteArrayList(); |
590 |
|
c.subList(3,1); |
592 |
– |
|
591 |
|
shouldThrow(); |
592 |
< |
} catch (IndexOutOfBoundsException e) {} |
592 |
> |
} catch (IndexOutOfBoundsException success) {} |
593 |
|
} |
594 |
|
|
595 |
|
/** |
596 |
< |
* a deserialized serialiszed list is equal |
596 |
> |
* a deserialized serialized list is equal |
597 |
|
*/ |
598 |
|
public void testSerialization() throws Exception { |
599 |
|
CopyOnWriteArrayList q = populatedArray(SIZE); |