--- jsr166/src/test/tck/ConcurrentSkipListSubMapTest.java 2009/11/21 10:25:05 1.10 +++ jsr166/src/test/tck/ConcurrentSkipListSubMapTest.java 2009/12/23 00:47:16 1.14 @@ -343,7 +343,6 @@ public class ConcurrentSkipListSubMapTes map.remove(four, "A"); assertEquals(4, map.size()); assertTrue(map.containsKey(four)); - } /** @@ -362,7 +361,6 @@ public class ConcurrentSkipListSubMapTes Map.Entry e4 = map.lowerEntry(zero); assertNull(e4); - } /** @@ -381,7 +379,6 @@ public class ConcurrentSkipListSubMapTes Map.Entry e4 = map.higherEntry(six); assertNull(e4); - } /** @@ -400,7 +397,6 @@ public class ConcurrentSkipListSubMapTes Map.Entry e4 = map.floorEntry(zero); assertNull(e4); - } /** @@ -419,7 +415,6 @@ public class ConcurrentSkipListSubMapTes Map.Entry e4 = map.ceilingEntry(six); assertNull(e4); - } /** @@ -444,8 +439,7 @@ public class ConcurrentSkipListSubMapTes try { e.setValue("A"); shouldThrow(); - } catch (Exception ok) { - } + } catch (UnsupportedOperationException success) {} e = map.pollFirstEntry(); assertNull(e); } @@ -472,8 +466,7 @@ public class ConcurrentSkipListSubMapTes try { e.setValue("E"); shouldThrow(); - } catch (Exception ok) { - } + } catch (UnsupportedOperationException success) {} e = map.pollLastEntry(); assertNull(e); } @@ -509,7 +502,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = map5(); c.get(null); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -520,7 +513,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = map5(); c.containsKey(null); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -531,7 +524,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = map0(); c.containsValue(null); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } @@ -543,7 +536,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = map5(); c.put(null, "whatever"); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -554,7 +547,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = map5(); c.putIfAbsent(null, "whatever"); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -565,7 +558,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = map5(); c.replace(null, "whatever"); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -576,7 +569,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = map5(); c.replace(null, one, "whatever"); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -587,7 +580,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = map5(); c.remove(null); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -598,7 +591,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = map5(); c.remove(null, "whatever"); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -651,7 +644,7 @@ public class ConcurrentSkipListSubMapTes 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()); } @@ -679,7 +672,7 @@ public class ConcurrentSkipListSubMapTes 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()); } @@ -751,7 +744,7 @@ public class ConcurrentSkipListSubMapTes SortedMap ssm = sm.tailMap(four); 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()); @@ -1037,7 +1030,6 @@ public class ConcurrentSkipListSubMapTes map.remove(m4, "A"); assertEquals(4, map.size()); assertTrue(map.containsKey(m4)); - } /** @@ -1056,7 +1048,6 @@ public class ConcurrentSkipListSubMapTes Map.Entry e4 = map.lowerEntry(zero); assertNull(e4); - } /** @@ -1075,7 +1066,6 @@ public class ConcurrentSkipListSubMapTes Map.Entry e4 = map.higherEntry(m6); assertNull(e4); - } /** @@ -1094,7 +1084,6 @@ public class ConcurrentSkipListSubMapTes Map.Entry e4 = map.floorEntry(zero); assertNull(e4); - } /** @@ -1113,7 +1102,6 @@ public class ConcurrentSkipListSubMapTes Map.Entry e4 = map.ceilingEntry(m6); assertNull(e4); - } /** @@ -1138,8 +1126,7 @@ public class ConcurrentSkipListSubMapTes try { e.setValue("A"); shouldThrow(); - } catch (Exception ok) { - } + } catch (UnsupportedOperationException success) {} e = map.pollFirstEntry(); assertNull(e); } @@ -1166,8 +1153,7 @@ public class ConcurrentSkipListSubMapTes try { e.setValue("E"); shouldThrow(); - } catch (Exception ok) { - } + } catch (UnsupportedOperationException success) {} e = map.pollLastEntry(); assertNull(e); } @@ -1196,25 +1182,25 @@ public class ConcurrentSkipListSubMapTes // Exception testDescendings /** - * get(null) of nm1mpty map throws NPE + * get(null) of empty map throws NPE */ public void testDescendingGet_NullPointerException() { try { ConcurrentNavigableMap c = dmap5(); c.get(null); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** - * containsKey(null) of nm1mpty map throws NPE + * containsKey(null) of empty map throws NPE */ public void testDescendingContainsKey_NullPointerException() { try { ConcurrentNavigableMap c = dmap5(); c.containsKey(null); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -1225,7 +1211,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = dmap0(); c.containsValue(null); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } @@ -1237,7 +1223,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = dmap5(); c.put(null, "whatever"); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -1248,7 +1234,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = dmap5(); c.putIfAbsent(null, "whatever"); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -1259,7 +1245,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = dmap5(); c.replace(null, "whatever"); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -1270,7 +1256,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = dmap5(); c.replace(null, m1, "whatever"); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -1281,7 +1267,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = dmap5(); c.remove(null); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -1292,7 +1278,7 @@ public class ConcurrentSkipListSubMapTes ConcurrentNavigableMap c = dmap5(); c.remove(null, "whatever"); shouldThrow(); - } catch (NullPointerException e) {} + } catch (NullPointerException success) {} } /** @@ -1344,7 +1330,7 @@ public class ConcurrentSkipListSubMapTes assertEquals(1, sm.size()); assertEquals(m3, sm.firstKey()); assertEquals(m3, sm.lastKey()); - assertTrue(sm.remove(m3) != null); + assertEquals("C", sm.remove(m3)); assertTrue(sm.isEmpty()); assertEquals(3, map.size()); } @@ -1372,7 +1358,7 @@ public class ConcurrentSkipListSubMapTes assertEquals(4, map.size()); assertEquals(0, sm.size()); assertTrue(sm.isEmpty()); - assertTrue(sm.remove(m3) == null); + assertSame(sm.remove(m3), null); assertEquals(4, map.size()); } @@ -1444,7 +1430,7 @@ public class ConcurrentSkipListSubMapTes SortedMap ssm = sm.tailMap(m4); assertEquals(m4, ssm.firstKey()); assertEquals(m5, ssm.lastKey()); - assertTrue(ssm.remove(m4) != null); + assertEquals("D", ssm.remove(m4)); assertEquals(1, ssm.size()); assertEquals(3, sm.size()); assertEquals(4, map.size());