--- jsr166/src/test/tck/ConcurrentSkipListSetTest.java 2009/11/16 05:30:07 1.6 +++ jsr166/src/test/tck/ConcurrentSkipListSetTest.java 2009/11/21 02:07:26 1.7 @@ -11,10 +11,10 @@ import java.io.*; public class ConcurrentSkipListSetTest 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(ConcurrentSkipListSetTest.class); + return new TestSuite(ConcurrentSkipListSetTest.class); } static class MyReverseComparator implements Comparator { @@ -34,12 +34,12 @@ public class ConcurrentSkipListSetTest e private ConcurrentSkipListSet populatedSet(int n) { 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))); assertFalse(q.isEmpty()); - assertEquals(n, q.size()); + assertEquals(n, q.size()); return q; } @@ -54,7 +54,7 @@ public class ConcurrentSkipListSetTest e q.add(three); q.add(four); q.add(five); - assertEquals(5, q.size()); + assertEquals(5, q.size()); return q; } @@ -168,7 +168,7 @@ public class ConcurrentSkipListSetTest e * add(null) throws NPE */ public void testAddNull() { - try { + try { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); q.add(null); shouldThrow(); @@ -272,7 +272,7 @@ public class ConcurrentSkipListSetTest e for (int i = 0; i < SIZE; ++i) { assertEquals(i, ((Integer)q.pollFirst()).intValue()); } - assertNull(q.pollFirst()); + assertNull(q.pollFirst()); } /** @@ -283,7 +283,7 @@ public class ConcurrentSkipListSetTest e for (int i = SIZE-1; i >= 0; --i) { assertEquals(i, ((Integer)q.pollLast()).intValue()); } - assertNull(q.pollFirst()); + assertNull(q.pollFirst()); } @@ -460,10 +460,10 @@ public class ConcurrentSkipListSetTest e */ public void testToArray() { ConcurrentSkipListSet 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()); } /** @@ -471,8 +471,8 @@ public class ConcurrentSkipListSetTest e */ public void testToArray2() { ConcurrentSkipListSet 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++) assertEquals(ints[i], q.pollFirst()); @@ -484,7 +484,7 @@ public class ConcurrentSkipListSetTest e public void testIterator() { ConcurrentSkipListSet q = populatedSet(SIZE); int i = 0; - Iterator it = q.iterator(); + Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; @@ -498,7 +498,7 @@ public class ConcurrentSkipListSetTest e public void testEmptyIterator() { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); int i = 0; - Iterator it = q.iterator(); + Iterator it = q.iterator(); while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; @@ -686,8 +686,8 @@ public class ConcurrentSkipListSetTest e * Subsets of subsets subdivide correctly */ public void testRecursiveSubSets() { - int setSize = 1000; - Class cl = ConcurrentSkipListSet.class; + int setSize = 1000; + Class cl = ConcurrentSkipListSet.class; NavigableSet set = newSet(cl); bs = new BitSet(setSize); @@ -706,11 +706,11 @@ public class ConcurrentSkipListSetTest e static NavigableSet newSet(Class cl) { NavigableSet result = null; - try { + try { result = (NavigableSet) cl.newInstance(); - } catch (Exception e) { + } catch (Exception e) { fail(); - } + } assertEquals(result.size(), 0); assertFalse(result.iterator().hasNext()); return result;