--- jsr166/src/test/extra166y/ParallelArrayAsListTest.java 2009/11/01 22:00:35 1.1 +++ jsr166/src/test/extra166y/ParallelArrayAsListTest.java 2009/11/16 04:57:09 1.3 @@ -2,8 +2,8 @@ * 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. + * Other contributors include Andrew Wright, Jeffrey Hayes, + * Pat Fisher, Mike Judd. */ import junit.framework.*; @@ -14,9 +14,9 @@ import extra166y.*; import java.io.*; public class ParallelArrayAsListTest extends JSR166TestCase{ - + public static void main(String[] args) { - junit.textui.TestRunner.run (suite()); + junit.textui.TestRunner.run (suite()); } public static Test suite() { @@ -26,7 +26,7 @@ public class ParallelArrayAsListTest ext static List populatedArray(int n){ List a = ParallelArray.createEmpty(n, Object.class, ParallelArray.defaultExecutor()).asList(); 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()); @@ -56,10 +56,10 @@ public class ParallelArrayAsListTest ext for (int i = 0; i < SIZE-1; ++i) ints[i] = new Integer(i); List a = ParallelArray.createUsingHandoff(ints, ParallelArray.defaultExecutor()).asList(); - 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 @@ -128,7 +128,7 @@ public class ParallelArrayAsListTest ext assertEquals(a.hashCode(), b.hashCode()); } - + /** * containsAll returns true for collection with subset of elements */ @@ -170,13 +170,13 @@ public class ParallelArrayAsListTest ext } /** - * iterator() returns an iterator containing the elements of the list + * iterator() returns an iterator containing the elements of the list */ public void testIterator() { List full = populatedArray(SIZE); Iterator i = full.iterator(); int j; - for(j = 0; i.hasNext(); j++) + for (j = 0; i.hasNext(); j++) assertEquals(j, ((Integer)i.next()).intValue()); assertEquals(SIZE, j); } @@ -202,7 +202,7 @@ public class ParallelArrayAsListTest ext for (int i = 0; i < 3; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } - } + } /** * lastIndexOf returns the index for the given object @@ -222,7 +222,7 @@ public class ParallelArrayAsListTest ext List full = populatedArray(SIZE); ListIterator i = full.listIterator(); int j; - for(j = 0; i.hasNext(); j++) + for (j = 0; i.hasNext(); j++) assertEquals(j, ((Integer)i.next()).intValue()); assertEquals(SIZE, j); } @@ -234,7 +234,7 @@ public class ParallelArrayAsListTest ext List full = populatedArray(3); ListIterator i = full.listIterator(1); int j; - for(j = 0; i.hasNext(); j++) + for (j = 0; i.hasNext(); j++) assertEquals(j+1, ((Integer)i.next()).intValue()); assertEquals(2, j); } @@ -312,10 +312,10 @@ public class ParallelArrayAsListTest ext public void testSubList() { List a = populatedArray(10); assertTrue(a.subList(1,1).isEmpty()); - for(int j = 0; j < 9; ++j) { - for(int i = j ; i < 10; ++i) { + for (int j = 0; j < 9; ++j) { + for (int i = j ; i < 10; ++i) { List b = a.subList(j,i); - for(int k = j; k < i; ++k) { + for (int k = j; k < i; ++k) { assertEquals(new Integer(k), b.get(k-j)); } } @@ -342,7 +342,7 @@ public class ParallelArrayAsListTest ext c.add("asdadasd"); c.toArray(new Long[5]); shouldThrow(); - } catch(ArrayStoreException e){} + } catch (ArrayStoreException e){} } /** @@ -353,9 +353,9 @@ public class ParallelArrayAsListTest ext List c = emptyArray(); c.get(-1); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } - + /** * get throws an IndexOutOfBoundsException on a too high index */ @@ -366,7 +366,7 @@ public class ParallelArrayAsListTest ext c.add("asdad"); c.get(100); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } /** @@ -377,9 +377,9 @@ public class ParallelArrayAsListTest ext List c = emptyArray(); c.set(-1,"qwerty"); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } - + /** * set throws an IndexOutOfBoundsException on a too high index */ @@ -390,7 +390,7 @@ public class ParallelArrayAsListTest ext c.add("asdad"); c.set(100, "qwerty"); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } /** @@ -401,9 +401,9 @@ public class ParallelArrayAsListTest ext List c = emptyArray(); c.add(-1,"qwerty"); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } - + /** * add throws an IndexOutOfBoundsException on a too high index */ @@ -414,7 +414,7 @@ public class ParallelArrayAsListTest ext c.add("asdasdasd"); c.add(100, "qwerty"); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } /** @@ -425,7 +425,7 @@ public class ParallelArrayAsListTest ext List c = emptyArray(); c.remove(-1); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } /** @@ -438,9 +438,9 @@ public class ParallelArrayAsListTest ext c.add("adasdasd"); c.remove(100); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } - + /** * addAll throws an IndexOutOfBoundsException on a negative index */ @@ -449,9 +449,9 @@ public class ParallelArrayAsListTest ext List c = emptyArray(); c.addAll(-1,new LinkedList()); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } - + /** * addAll throws an IndexOutOfBoundsException on a too high index */ @@ -462,7 +462,7 @@ public class ParallelArrayAsListTest ext c.add("asdasdasd"); c.addAll(100, new LinkedList()); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } /** @@ -473,7 +473,7 @@ public class ParallelArrayAsListTest ext List c = emptyArray(); c.listIterator(-1); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } /** @@ -486,7 +486,7 @@ public class ParallelArrayAsListTest ext c.add("asdasdas"); c.listIterator(100); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } /** @@ -498,7 +498,7 @@ public class ParallelArrayAsListTest ext c.subList(-1,100); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } /** @@ -510,12 +510,12 @@ public class ParallelArrayAsListTest ext c.add("asdasd"); c.subList(1,100); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } /** * subList throws IndexOutOfBoundsException when the second index - * is lower then the first + * is lower then the first */ public void testSubList3_IndexOutOfBoundsException() { try { @@ -523,8 +523,8 @@ public class ParallelArrayAsListTest ext c.subList(3,1); shouldThrow(); - } catch(IndexOutOfBoundsException e){} + } catch (IndexOutOfBoundsException e){} } - + }