--- jsr166/src/test/tck/CopyOnWriteArraySetTest.java 2009/11/21 10:25:05 1.12 +++ jsr166/src/test/tck/CopyOnWriteArraySetTest.java 2011/03/15 19:47:06 1.17 @@ -1,7 +1,7 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ * Other contributors include Andrew Wright, Jeffrey Hayes, * Pat Fisher, Mike Judd. */ @@ -13,7 +13,7 @@ import java.io.*; public class CopyOnWriteArraySetTest extends JSR166TestCase { public static void main(String[] args) { - junit.textui.TestRunner.run (suite()); + junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(CopyOnWriteArraySetTest.class); @@ -51,7 +51,7 @@ public class CopyOnWriteArraySetTest ext /** - * addAll adds each element from the given collection + * addAll adds each element from the given collection */ public void testAddAll() { CopyOnWriteArraySet full = populatedSet(3); @@ -64,8 +64,8 @@ public class CopyOnWriteArraySetTest ext } /** - * addAll adds each element from the given collection that did not - * already exist in the set + * addAll adds each element from the given collection that did not + * already exist in the set */ public void testAddAll2() { CopyOnWriteArraySet full = populatedSet(3); @@ -78,7 +78,7 @@ public class CopyOnWriteArraySetTest ext } /** - * add will not add the element if it already exists in the set + * add will not add the element if it already exists in the set */ public void testAdd2() { CopyOnWriteArraySet full = populatedSet(3); @@ -87,8 +87,7 @@ public class CopyOnWriteArraySetTest ext } /** - * add adds the element when it does not exist - * in the set + * add adds the element when it does not exist in the set */ public void testAdd3() { CopyOnWriteArraySet full = populatedSet(3); @@ -97,7 +96,7 @@ public class CopyOnWriteArraySetTest ext } /** - * clear removes all elements from the set + * clear removes all elements from the set */ public void testClear() { CopyOnWriteArraySet full = populatedSet(3); @@ -106,7 +105,7 @@ public class CopyOnWriteArraySetTest ext } /** - * contains returns true for added elements + * contains returns true for added elements */ public void testContains() { CopyOnWriteArraySet full = populatedSet(3); @@ -134,7 +133,7 @@ public class CopyOnWriteArraySetTest ext /** - * containsAll returns true for collections with subset of elements + * containsAll returns true for collections with subset of elements */ public void testContainsAll() { CopyOnWriteArraySet full = populatedSet(3); @@ -147,7 +146,7 @@ public class CopyOnWriteArraySetTest ext } /** - * isEmpty is true when empty, else false + * isEmpty is true when empty, else false */ public void testIsEmpty() { CopyOnWriteArraySet empty = new CopyOnWriteArraySet(); @@ -157,21 +156,21 @@ public class CopyOnWriteArraySetTest ext } /** - * iterator() returns an iterator containing the elements of the set + * iterator() returns an iterator containing the elements of the set */ public void testIterator() { CopyOnWriteArraySet full = populatedSet(3); Iterator i = full.iterator(); int j; for (j = 0; i.hasNext(); j++) - assertEquals(j, ((Integer)i.next()).intValue()); + assertEquals(j, i.next()); assertEquals(3, j); } /** * iterator remove is unsupported */ - public void testIteratorRemove () { + public void testIteratorRemove() { CopyOnWriteArraySet full = populatedSet(3); Iterator it = full.iterator(); it.next(); @@ -194,7 +193,7 @@ public class CopyOnWriteArraySetTest ext /** - * removeAll removes all elements from the given collection + * removeAll removes all elements from the given collection */ public void testRemoveAll() { CopyOnWriteArraySet full = populatedSet(3); @@ -217,7 +216,7 @@ public class CopyOnWriteArraySetTest ext } /** - * size returns the number of elements + * size returns the number of elements */ public void testSize() { CopyOnWriteArraySet empty = new CopyOnWriteArraySet(); @@ -227,35 +226,35 @@ public class CopyOnWriteArraySetTest ext } /** - * toArray returns an Object array containing all elements from the set + * toArray returns an Object array containing all elements from the set */ public void testToArray() { CopyOnWriteArraySet full = populatedSet(3); Object[] o = full.toArray(); assertEquals(3, o.length); - assertEquals(0, ((Integer)o[0]).intValue()); - assertEquals(1, ((Integer)o[1]).intValue()); - assertEquals(2, ((Integer)o[2]).intValue()); + assertEquals(0, o[0]); + assertEquals(1, o[1]); + assertEquals(2, o[2]); } /** - * toArray returns an Integer array containing all elements from - * the set + * toArray returns an Integer array containing all elements from + * the set */ public void testToArray2() { CopyOnWriteArraySet full = populatedSet(3); Integer[] i = new Integer[3]; i = (Integer[])full.toArray(i); assertEquals(3, i.length); - assertEquals(0, i[0].intValue()); - assertEquals(1, i[1].intValue()); - assertEquals(2, i[2].intValue()); + assertEquals(0, (int) i[0]); + assertEquals(1, (int) i[1]); + assertEquals(2, (int) i[2]); } /** - * toArray throws an ArrayStoreException when the given array can - * not store the objects inside the set + * toArray throws an ArrayStoreException when the given array can + * not store the objects inside the set */ public void testToArray_ArrayStoreException() { try { @@ -264,7 +263,7 @@ public class CopyOnWriteArraySetTest ext c.add("asdadasd"); c.toArray(new Long[5]); shouldThrow(); - } catch (ArrayStoreException e) {} + } catch (ArrayStoreException success) {} } /**