--- jsr166/src/test/tck/ConcurrentSkipListMapTest.java 2009/11/21 17:38:05 1.14 +++ jsr166/src/test/tck/ConcurrentSkipListMapTest.java 2010/10/11 05:40:41 1.21 @@ -11,7 +11,7 @@ import java.io.*; public class ConcurrentSkipListMapTest 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(ConcurrentSkipListMapTest.class); @@ -34,7 +34,7 @@ public class ConcurrentSkipListMapTest e } /** - * clear removes all pairs + * clear removes all pairs */ public void testClear() { ConcurrentSkipListMap map = map5(); @@ -52,7 +52,7 @@ public class ConcurrentSkipListMapTest e } /** - * Maps with same contents are equal + * Maps with same contents are equal */ public void testEquals() { ConcurrentSkipListMap map1 = map5(); @@ -65,7 +65,7 @@ public class ConcurrentSkipListMapTest e } /** - * containsKey returns true for contained key + * containsKey returns true for contained key */ public void testContainsKey() { ConcurrentSkipListMap map = map5(); @@ -74,7 +74,7 @@ public class ConcurrentSkipListMapTest e } /** - * containsValue returns true for held values + * containsValue returns true for held values */ public void testContainsValue() { ConcurrentSkipListMap map = map5(); @@ -83,8 +83,8 @@ public class ConcurrentSkipListMapTest e } /** - * get returns the correct element at the given key, - * or null if not present + * get returns the correct element at the given key, + * or null if not present */ public void testGet() { ConcurrentSkipListMap map = map5(); @@ -94,7 +94,7 @@ public class ConcurrentSkipListMapTest e } /** - * isEmpty is true of empty map and false for non-empty + * isEmpty is true of empty map and false for non-empty */ public void testIsEmpty() { ConcurrentSkipListMap empty = new ConcurrentSkipListMap(); @@ -104,7 +104,7 @@ public class ConcurrentSkipListMapTest e } /** - * firstKey returns first key + * firstKey returns first key */ public void testFirstKey() { ConcurrentSkipListMap map = map5(); @@ -112,7 +112,7 @@ public class ConcurrentSkipListMapTest e } /** - * lastKey returns last key + * lastKey returns last key */ public void testLastKey() { ConcurrentSkipListMap map = map5(); @@ -121,7 +121,7 @@ public class ConcurrentSkipListMapTest e /** - * keySet.toArray returns contains all keys + * keySet.toArray returns contains all keys */ public void testKeySetToArray() { ConcurrentSkipListMap map = map5(); @@ -134,7 +134,7 @@ public class ConcurrentSkipListMapTest e } /** - * descendingkeySet.toArray returns contains all keys + * descendingkeySet.toArray returns contains all keys */ public void testDescendingKeySetToArray() { ConcurrentSkipListMap map = map5(); @@ -147,7 +147,7 @@ public class ConcurrentSkipListMapTest e } /** - * keySet returns a Set containing all the keys + * keySet returns a Set containing all the keys */ public void testKeySet() { ConcurrentSkipListMap map = map5(); @@ -161,7 +161,7 @@ public class ConcurrentSkipListMapTest e } /** - * keySet is ordered + * keySet is ordered */ public void testKeySetOrder() { ConcurrentSkipListMap map = map5(); @@ -199,7 +199,7 @@ public class ConcurrentSkipListMapTest e } /** - * descendingKeySet is ordered + * descendingKeySet is ordered */ public void testDescendingKeySetOrder() { ConcurrentSkipListMap map = map5(); @@ -218,7 +218,7 @@ public class ConcurrentSkipListMapTest e } /** - * descending iterator of descendingKeySet is ordered + * descending iterator of descendingKeySet is ordered */ public void testDescendingKeySetDescendingIteratorOrder() { ConcurrentSkipListMap map = map5(); @@ -237,7 +237,7 @@ public class ConcurrentSkipListMapTest e } /** - * Values.toArray contains all values + * Values.toArray contains all values */ public void testValuesToArray() { ConcurrentSkipListMap map = map5(); @@ -305,7 +305,7 @@ public class ConcurrentSkipListMapTest e } /** - * entrySet.toArray contains all entries + * entrySet.toArray contains all entries */ public void testEntrySetToArray() { ConcurrentSkipListMap map = map5(); @@ -319,7 +319,7 @@ public class ConcurrentSkipListMapTest e } /** - * descendingEntrySet.toArray contains all entries + * descendingEntrySet.toArray contains all entries */ public void testDescendingEntrySetToArray() { ConcurrentSkipListMap map = map5(); @@ -333,7 +333,7 @@ public class ConcurrentSkipListMapTest e } /** - * putAll adds all key-value pairs from the given map + * putAll adds all key-value pairs from the given map */ public void testPutAll() { ConcurrentSkipListMap empty = new ConcurrentSkipListMap(); @@ -348,7 +348,7 @@ public class ConcurrentSkipListMapTest e } /** - * putIfAbsent works when the given key is not present + * putIfAbsent works when the given key is not present */ public void testPutIfAbsent() { ConcurrentSkipListMap map = map5(); @@ -357,7 +357,7 @@ public class ConcurrentSkipListMapTest e } /** - * putIfAbsent does not add the pair if the key is already present + * putIfAbsent does not add the pair if the key is already present */ public void testPutIfAbsent2() { ConcurrentSkipListMap map = map5(); @@ -365,7 +365,7 @@ public class ConcurrentSkipListMapTest e } /** - * replace fails when the given key is not present + * replace fails when the given key is not present */ public void testReplace() { ConcurrentSkipListMap map = map5(); @@ -374,7 +374,7 @@ public class ConcurrentSkipListMapTest e } /** - * replace succeeds if the key is already present + * replace succeeds if the key is already present */ public void testReplace2() { ConcurrentSkipListMap map = map5(); @@ -405,7 +405,7 @@ public class ConcurrentSkipListMapTest e /** - * remove removes the correct key-value pair from the map + * remove removes the correct key-value pair from the map */ public void testRemove() { ConcurrentSkipListMap map = map5(); @@ -427,7 +427,6 @@ public class ConcurrentSkipListMapTest e map.remove(four, "A"); assertEquals(4, map.size()); assertTrue(map.containsKey(four)); - } /** @@ -446,7 +445,6 @@ public class ConcurrentSkipListMapTest e Map.Entry e4 = map.lowerEntry(zero); assertNull(e4); - } /** @@ -465,7 +463,6 @@ public class ConcurrentSkipListMapTest e Map.Entry e4 = map.higherEntry(six); assertNull(e4); - } /** @@ -484,7 +481,6 @@ public class ConcurrentSkipListMapTest e Map.Entry e4 = map.floorEntry(zero); assertNull(e4); - } /** @@ -503,12 +499,11 @@ public class ConcurrentSkipListMapTest e Map.Entry e4 = map.ceilingEntry(six); assertNull(e4); - } /** * lowerEntry, higherEntry, ceilingEntry, and floorEntry return - * imutable entries + * immutable entries */ public void testEntryImmutablity() { ConcurrentSkipListMap map = map5(); @@ -556,7 +551,6 @@ public class ConcurrentSkipListMapTest e Object e4 = q.lowerKey(zero); assertNull(e4); - } /** @@ -575,7 +569,6 @@ public class ConcurrentSkipListMapTest e Object e4 = q.higherKey(six); assertNull(e4); - } /** @@ -594,7 +587,6 @@ public class ConcurrentSkipListMapTest e Object e4 = q.floorKey(zero); assertNull(e4); - } /** @@ -613,7 +605,6 @@ public class ConcurrentSkipListMapTest e Object e4 = q.ceilingKey(six); assertNull(e4); - } /** @@ -671,7 +662,7 @@ public class ConcurrentSkipListMapTest e } /** - * size returns the correct values + * size returns the correct values */ public void testSize() { ConcurrentSkipListMap map = map5(); @@ -861,7 +852,7 @@ public class ConcurrentSkipListMapTest e assertEquals(1, sm.size()); assertEquals(three, sm.firstKey()); assertEquals(three, sm.lastKey()); - assertTrue(sm.remove(three) != null); + assertEquals("C", sm.remove(three)); assertTrue(sm.isEmpty()); assertEquals(3, map.size()); } @@ -894,7 +885,7 @@ public class ConcurrentSkipListMapTest e assertEquals(4, map.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); - assertTrue(sm.remove(three) == null); + assertSame(sm.remove(three), null); assertEquals(4, map.size()); } @@ -976,7 +967,7 @@ public class ConcurrentSkipListMapTest e NavigableMap ssm = sm.tailMap(four, true); assertEquals(four, ssm.firstKey()); assertEquals(five, ssm.lastKey()); - assertTrue(ssm.remove(four) != null); + assertEquals("D", ssm.remove(four)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, map.size()); @@ -989,7 +980,7 @@ public class ConcurrentSkipListMapTest e * Submaps of submaps subdivide correctly */ public void testRecursiveSubMaps() throws Exception { - int mapSize = 1000; + int mapSize = expensiveTests ? 1000 : 100; Class cl = ConcurrentSkipListMap.class; NavigableMap map = newMap(cl); bs = new BitSet(mapSize); @@ -1201,7 +1192,7 @@ public class ConcurrentSkipListMapTest e // BitSet should support this! Test would run much faster while (key >= min) { if (bs.get(key)) - return(key); + return key; key--; } return -1;