--- jsr166/src/test/tck/ConcurrentSkipListSubSetTest.java 2009/11/02 20:28:31 1.5 +++ jsr166/src/test/tck/ConcurrentSkipListSubSetTest.java 2009/11/21 02:07:26 1.8 @@ -11,10 +11,10 @@ import java.io.*; public class ConcurrentSkipListSubSetTest 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(ConcurrentSkipListSubSetTest.class); + return new TestSuite(ConcurrentSkipListSubSetTest.class); } static class MyReverseComparator implements Comparator { @@ -35,15 +35,15 @@ public class ConcurrentSkipListSubSetTes ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertTrue(q.isEmpty()); - for(int i = n-1; i >= 0; i-=2) - assertTrue(q.add(new Integer(i))); - for(int i = (n & 1); i < n; i+=2) - assertTrue(q.add(new Integer(i))); + for (int i = n-1; i >= 0; i-=2) + assertTrue(q.add(new Integer(i))); + for (int i = (n & 1); i < n; i+=2) + assertTrue(q.add(new Integer(i))); assertTrue(q.add(new Integer(-n))); assertTrue(q.add(new Integer(n))); NavigableSet s = q.subSet(new Integer(0), true, new Integer(n), false); assertFalse(s.isEmpty()); - assertEquals(n, s.size()); + assertEquals(n, s.size()); return s; } @@ -61,7 +61,7 @@ public class ConcurrentSkipListSubSetTes q.add(zero); q.add(seven); NavigableSet s = q.subSet(one, true, seven, false); - assertEquals(5, s.size()); + assertEquals(5, s.size()); return s; } @@ -77,18 +77,18 @@ public class ConcurrentSkipListSubSetTes q.add(m4); q.add(m5); NavigableSet s = q.descendingSet(); - assertEquals(5, s.size()); + assertEquals(5, s.size()); return s; } private static NavigableSet set0() { - ConcurrentSkipListSet set = new ConcurrentSkipListSet(); + ConcurrentSkipListSet set = new ConcurrentSkipListSet(); assertTrue(set.isEmpty()); return set.tailSet(m1, true); } private static NavigableSet dset0() { - ConcurrentSkipListSet set = new ConcurrentSkipListSet(); + ConcurrentSkipListSet set = new ConcurrentSkipListSet(); assertTrue(set.isEmpty()); return set; } @@ -134,7 +134,7 @@ public class ConcurrentSkipListSubSetTes * add(null) throws NPE */ public void testAddNull() { - try { + try { NavigableSet q = set0(); q.add(null); shouldThrow(); @@ -169,7 +169,7 @@ public class ConcurrentSkipListSubSetTes q.add(new Object()); shouldThrow(); } - catch(ClassCastException success) {} + catch (ClassCastException success) {} } @@ -238,7 +238,7 @@ public class ConcurrentSkipListSubSetTes for (int i = 0; i < SIZE; ++i) { assertEquals(i, ((Integer)q.pollFirst()).intValue()); } - assertNull(q.pollFirst()); + assertNull(q.pollFirst()); } /** @@ -414,10 +414,10 @@ public class ConcurrentSkipListSubSetTes */ public void testToArray() { NavigableSet q = populatedSet(SIZE); - Object[] o = q.toArray(); + Object[] o = q.toArray(); Arrays.sort(o); - for(int i = 0; i < o.length; i++) - assertEquals(o[i], q.pollFirst()); + for (int i = 0; i < o.length; i++) + assertEquals(o[i], q.pollFirst()); } /** @@ -425,10 +425,10 @@ public class ConcurrentSkipListSubSetTes */ public void testToArray2() { NavigableSet q = populatedSet(SIZE); - Integer[] ints = new Integer[SIZE]; - ints = (Integer[])q.toArray(ints); + Integer[] ints = new Integer[SIZE]; + ints = (Integer[])q.toArray(ints); Arrays.sort(ints); - for(int i = 0; i < ints.length; i++) + for (int i = 0; i < ints.length; i++) assertEquals(ints[i], q.pollFirst()); } @@ -438,8 +438,8 @@ public class ConcurrentSkipListSubSetTes public void testIterator() { NavigableSet q = populatedSet(SIZE); int i = 0; - Iterator it = q.iterator(); - while(it.hasNext()) { + Iterator it = q.iterator(); + while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } @@ -452,8 +452,8 @@ public class ConcurrentSkipListSubSetTes public void testEmptyIterator() { NavigableSet q = set0(); int i = 0; - Iterator it = q.iterator(); - while(it.hasNext()) { + Iterator it = q.iterator(); + while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } @@ -508,7 +508,7 @@ public class ConcurrentSkipListSubSetTes assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.pollFirst(), r.pollFirst()); - } catch(Exception e){ + } catch (Exception e) { e.printStackTrace(); unexpectedException(); } @@ -652,7 +652,7 @@ public class ConcurrentSkipListSubSetTes * add(null) throws NPE */ public void testDescendingAddNull() { - try { + try { NavigableSet q = dset0(); q.add(null); shouldThrow(); @@ -687,7 +687,7 @@ public class ConcurrentSkipListSubSetTes q.add(new Object()); shouldThrow(); } - catch(ClassCastException success) {} + catch (ClassCastException success) {} } @@ -756,7 +756,7 @@ public class ConcurrentSkipListSubSetTes for (int i = 0; i < SIZE; ++i) { assertEquals(i, ((Integer)q.pollFirst()).intValue()); } - assertNull(q.pollFirst()); + assertNull(q.pollFirst()); } /** @@ -932,10 +932,10 @@ public class ConcurrentSkipListSubSetTes */ public void testDescendingToArray() { NavigableSet q = populatedSet(SIZE); - Object[] o = q.toArray(); + Object[] o = q.toArray(); Arrays.sort(o); - for(int i = 0; i < o.length; i++) - assertEquals(o[i], q.pollFirst()); + for (int i = 0; i < o.length; i++) + assertEquals(o[i], q.pollFirst()); } /** @@ -943,10 +943,10 @@ public class ConcurrentSkipListSubSetTes */ public void testDescendingToArray2() { NavigableSet q = populatedSet(SIZE); - Integer[] ints = new Integer[SIZE]; - ints = (Integer[])q.toArray(ints); + Integer[] ints = new Integer[SIZE]; + ints = (Integer[])q.toArray(ints); Arrays.sort(ints); - for(int i = 0; i < ints.length; i++) + for (int i = 0; i < ints.length; i++) assertEquals(ints[i], q.pollFirst()); } @@ -956,8 +956,8 @@ public class ConcurrentSkipListSubSetTes public void testDescendingIterator() { NavigableSet q = populatedSet(SIZE); int i = 0; - Iterator it = q.iterator(); - while(it.hasNext()) { + Iterator it = q.iterator(); + while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } @@ -970,8 +970,8 @@ public class ConcurrentSkipListSubSetTes public void testDescendingEmptyIterator() { NavigableSet q = dset0(); int i = 0; - Iterator it = q.iterator(); - while(it.hasNext()) { + Iterator it = q.iterator(); + while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } @@ -1026,7 +1026,7 @@ public class ConcurrentSkipListSubSetTes assertEquals(q.size(), r.size()); while (!q.isEmpty()) assertEquals(q.pollFirst(), r.pollFirst()); - } catch(Exception e){ + } catch (Exception e) { e.printStackTrace(); unexpectedException(); }