--- jsr166/src/test/tck/ConcurrentSkipListSubSetTest.java 2006/04/20 20:35:00 1.4 +++ jsr166/src/test/tck/ConcurrentSkipListSubSetTest.java 2009/11/16 04:57:10 1.6 @@ -11,13 +11,13 @@ 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); } - static class MyReverseComparator implements Comparator { + static class MyReverseComparator implements Comparator { public int compare(Object x, Object y) { int i = ((Integer)x).intValue(); int j = ((Integer)y).intValue(); @@ -35,9 +35,9 @@ public class ConcurrentSkipListSubSetTes ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertTrue(q.isEmpty()); - for(int i = n-1; i >= 0; i-=2) + for (int i = n-1; i >= 0; i-=2) assertTrue(q.add(new Integer(i))); - for(int i = (n & 1); i < n; i+=2) + 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))); @@ -81,18 +81,18 @@ public class ConcurrentSkipListSubSetTes return s; } - private static NavigableSet set0() { + private static NavigableSet set0() { ConcurrentSkipListSet set = new ConcurrentSkipListSet(); assertTrue(set.isEmpty()); return set.tailSet(m1, true); } - private static NavigableSet dset0() { + private static NavigableSet dset0() { ConcurrentSkipListSet set = new ConcurrentSkipListSet(); assertTrue(set.isEmpty()); return set; } - + /** * A new set has unbounded capacity */ @@ -138,7 +138,7 @@ public class ConcurrentSkipListSubSetTes NavigableSet q = set0(); q.add(null); shouldThrow(); - } catch (NullPointerException success) { } + } catch (NullPointerException success) { } } /** @@ -169,7 +169,7 @@ public class ConcurrentSkipListSubSetTes q.add(new Object()); shouldThrow(); } - catch(ClassCastException success) {} + catch (ClassCastException success) {} } @@ -255,7 +255,7 @@ public class ConcurrentSkipListSubSetTes } assertTrue(q.isEmpty()); } - + /** * contains(x) reports true when elements added but not yet removed */ @@ -331,7 +331,7 @@ public class ConcurrentSkipListSubSetTes } } - + /** * lower returns preceding element @@ -416,7 +416,7 @@ public class ConcurrentSkipListSubSetTes NavigableSet q = populatedSet(SIZE); Object[] o = q.toArray(); Arrays.sort(o); - for(int i = 0; i < o.length; i++) + for (int i = 0; i < o.length; i++) assertEquals(o[i], q.pollFirst()); } @@ -428,10 +428,10 @@ public class ConcurrentSkipListSubSetTes 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()); } - + /** * iterator iterates through all elements */ @@ -439,7 +439,7 @@ public class ConcurrentSkipListSubSetTes NavigableSet q = populatedSet(SIZE); int i = 0; Iterator it = q.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } @@ -453,7 +453,7 @@ public class ConcurrentSkipListSubSetTes NavigableSet q = set0(); int i = 0; Iterator it = q.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } @@ -489,10 +489,10 @@ public class ConcurrentSkipListSubSetTes for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } - } + } /** - * A deserialized serialized set has same elements + * A deserialized serialized set has same elements */ public void testSerialization() { NavigableSet q = populatedSet(SIZE); @@ -506,9 +506,9 @@ public class ConcurrentSkipListSubSetTes ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); NavigableSet r = (NavigableSet)in.readObject(); assertEquals(q.size(), r.size()); - while (!q.isEmpty()) + while (!q.isEmpty()) assertEquals(q.pollFirst(), r.pollFirst()); - } catch(Exception e){ + } catch (Exception e){ e.printStackTrace(); unexpectedException(); } @@ -656,7 +656,7 @@ public class ConcurrentSkipListSubSetTes NavigableSet q = dset0(); q.add(null); shouldThrow(); - } catch (NullPointerException success) { } + } catch (NullPointerException success) { } } /** @@ -687,7 +687,7 @@ public class ConcurrentSkipListSubSetTes q.add(new Object()); shouldThrow(); } - catch(ClassCastException success) {} + catch (ClassCastException success) {} } @@ -773,7 +773,7 @@ public class ConcurrentSkipListSubSetTes } assertTrue(q.isEmpty()); } - + /** * contains(x) reports true when elements added but not yet removed */ @@ -849,7 +849,7 @@ public class ConcurrentSkipListSubSetTes } } - + /** * lower returns preceding element @@ -934,7 +934,7 @@ public class ConcurrentSkipListSubSetTes NavigableSet q = populatedSet(SIZE); Object[] o = q.toArray(); Arrays.sort(o); - for(int i = 0; i < o.length; i++) + for (int i = 0; i < o.length; i++) assertEquals(o[i], q.pollFirst()); } @@ -946,10 +946,10 @@ public class ConcurrentSkipListSubSetTes 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()); } - + /** * iterator iterates through all elements */ @@ -957,7 +957,7 @@ public class ConcurrentSkipListSubSetTes NavigableSet q = populatedSet(SIZE); int i = 0; Iterator it = q.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } @@ -971,7 +971,7 @@ public class ConcurrentSkipListSubSetTes NavigableSet q = dset0(); int i = 0; Iterator it = q.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { assertTrue(q.contains(it.next())); ++i; } @@ -1007,10 +1007,10 @@ public class ConcurrentSkipListSubSetTes for (int i = 0; i < SIZE; ++i) { assertTrue(s.indexOf(String.valueOf(i)) >= 0); } - } + } /** - * A deserialized serialized set has same elements + * A deserialized serialized set has same elements */ public void testDescendingSerialization() { NavigableSet q = populatedSet(SIZE); @@ -1024,9 +1024,9 @@ public class ConcurrentSkipListSubSetTes ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); NavigableSet r = (NavigableSet)in.readObject(); assertEquals(q.size(), r.size()); - while (!q.isEmpty()) + while (!q.isEmpty()) assertEquals(q.pollFirst(), r.pollFirst()); - } catch(Exception e){ + } catch (Exception e){ e.printStackTrace(); unexpectedException(); }