--- jsr166/src/test/tck/ConcurrentSkipListSetTest.java 2011/11/26 05:42:14 1.25 +++ jsr166/src/test/tck/ConcurrentSkipListSetTest.java 2013/05/30 03:28:55 1.30 @@ -32,7 +32,7 @@ public class ConcurrentSkipListSetTest e } /** - * Create a set of given size containing consecutive + * Returns a new set of given size containing consecutive * Integers 0 ... n. */ private ConcurrentSkipListSet populatedSet(int n) { @@ -49,7 +49,7 @@ public class ConcurrentSkipListSetTest e } /** - * Create set of first 5 ints + * Returns a new set of first 5 ints. */ private ConcurrentSkipListSet set5() { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); @@ -461,8 +461,7 @@ public class ConcurrentSkipListSetTest e public void testToArray2() { ConcurrentSkipListSet q = populatedSet(SIZE); Integer[] ints = new Integer[SIZE]; - Integer[] array = q.toArray(ints); - assertSame(ints, array); + assertSame(ints, q.toArray(ints)); for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.pollFirst()); } @@ -532,7 +531,7 @@ public class ConcurrentSkipListSetTest e NavigableSet x = populatedSet(SIZE); NavigableSet y = serialClone(x); - assertTrue(x != y); + assertNotSame(x, y); assertEquals(x.size(), y.size()); assertEquals(x, y); assertEquals(y, x); @@ -686,6 +685,17 @@ public class ConcurrentSkipListSetTest e 0, setSize - 1, true, bs); } + /** + * addAll is idempotent + */ + public void testAddAll_idempotent() throws Exception { + Set x = populatedSet(SIZE); + Set y = new ConcurrentSkipListSet(x); + y.addAll(x); + assertEquals(x, y); + assertEquals(y, x); + } + static NavigableSet newSet(Class cl) throws Exception { NavigableSet result = (NavigableSet) cl.newInstance(); assertEquals(0, result.size());