--- jsr166/src/test/tck/CopyOnWriteArrayListTest.java 2003/09/25 11:02:41 1.5 +++ jsr166/src/test/tck/CopyOnWriteArrayListTest.java 2009/11/02 20:28:31 1.8 @@ -1,8 +1,9 @@ /* - * Written by members of JCP JSR-166 Expert Group and released to the - * public domain. Use, modify, and redistribute this code in any way - * without acknowledgement. Other contributors include Andrew Wright, - * Jeffrey Hayes, Pat Fischer, Mike Judd. + * 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 + * Other contributors include Andrew Wright, Jeffrey Hayes, + * Pat Fisher, Mike Judd. */ import junit.framework.*; @@ -11,9 +12,9 @@ import java.util.concurrent.*; import java.io.*; public class CopyOnWriteArrayListTest extends JSR166TestCase{ - + public static void main(String[] args) { - junit.textui.TestRunner.run (suite()); + junit.textui.TestRunner.run (suite()); } public static Test suite() { @@ -23,7 +24,7 @@ public class CopyOnWriteArrayListTest ex static CopyOnWriteArrayList populatedArray(int n){ CopyOnWriteArrayList a = new CopyOnWriteArrayList(); assertTrue(a.isEmpty()); - for (int i = 0; i < n; ++i) + for (int i = 0; i < n; ++i) a.add(new Integer(i)); assertFalse(a.isEmpty()); assertEquals(n, a.size()); @@ -47,7 +48,7 @@ public class CopyOnWriteArrayListTest ex for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); CopyOnWriteArrayList a = new CopyOnWriteArrayList(ints); - for (int i = 0; i < SIZE; ++i) + for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], a.get(i)); } @@ -59,10 +60,10 @@ public class CopyOnWriteArrayListTest ex for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); CopyOnWriteArrayList a = new CopyOnWriteArrayList(Arrays.asList(ints)); - for (int i = 0; i < SIZE; ++i) + for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], a.get(i)); } - + /** * addAll adds each element from the given collection @@ -140,7 +141,7 @@ public class CopyOnWriteArrayListTest ex } /** - * adding at an index places it in the indindicated index + * adding at an index places it in the indicated index */ public void testAddIndex() { CopyOnWriteArrayList full = populatedArray(3); @@ -173,7 +174,7 @@ public class CopyOnWriteArrayListTest ex assertEquals(a.hashCode(), b.hashCode()); } - + /** * containsAll returns true for collection with subset of elements */ @@ -225,7 +226,7 @@ public class CopyOnWriteArrayListTest ex } /** - * iterator() returns an iterator containing the elements of the list + * iterator() returns an iterator containing the elements of the list */ public void testIterator() { CopyOnWriteArrayList full = populatedArray(SIZE); @@ -259,7 +260,7 @@ public class CopyOnWriteArrayListTest ex for (int i = 0; i < 3; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } - } + } /** * lastIndexOf returns the index for the given object @@ -423,7 +424,7 @@ public class CopyOnWriteArrayListTest ex shouldThrow(); } catch(IndexOutOfBoundsException e){} } - + /** * get throws an IndexOutOfBoundsException on a too high index */ @@ -447,7 +448,7 @@ public class CopyOnWriteArrayListTest ex shouldThrow(); } catch(IndexOutOfBoundsException e){} } - + /** * set throws an IndexOutOfBoundsException on a too high index */ @@ -471,7 +472,7 @@ public class CopyOnWriteArrayListTest ex shouldThrow(); } catch(IndexOutOfBoundsException e){} } - + /** * add throws an IndexOutOfBoundsException on a too high index */ @@ -508,7 +509,7 @@ public class CopyOnWriteArrayListTest ex shouldThrow(); } catch(IndexOutOfBoundsException e){} } - + /** * addAll throws an IndexOutOfBoundsException on a negative index */ @@ -519,7 +520,7 @@ public class CopyOnWriteArrayListTest ex shouldThrow(); } catch(IndexOutOfBoundsException e){} } - + /** * addAll throws an IndexOutOfBoundsException on a too high index */ @@ -583,7 +584,7 @@ public class CopyOnWriteArrayListTest ex /** * subList throws IndexOutOfBoundsException when the second index - * is lower then the first + * is lower then the first */ public void testSubList3_IndexOutOfBoundsException() { try { @@ -616,5 +617,5 @@ public class CopyOnWriteArrayListTest ex unexpectedException(); } } - + }