/** get(null) of nonempty map throws NPE */ public void testGet_NullPointerException() { try { ConcurrentNavigableMap c = map5(); c.get(null); shouldThrow(); } catch (NullPointerException success) { } }
/** remove(key,value) removes only if pair present */ public void testDescendingRemove2() { ConcurrentNavigableMap map = dmap5(); assertTrue(map.containsKey(m5)); assertEquals("E", map.get(m5)); map.remove(m5, "E"); assertEquals(4, map.size()); assertFalse(map.containsKey(m5)); map.remove(m4, "A"); assertEquals(4, map.size()); assertTrue(map.containsKey(m4)); }
/** remove(key,value) removes only if pair present */ public void testRemove2() { ConcurrentNavigableMap map = map5(); assertTrue(map.containsKey(five)); assertEquals("E", map.get(five)); map.remove(five, "E"); assertEquals(4, map.size()); assertFalse(map.containsKey(five)); map.remove(four, "A"); assertEquals(4, map.size()); assertTrue(map.containsKey(four)); }
/** get returns the correct element at the given key, or null if not present */ public void testGet() { ConcurrentNavigableMap map = map5(); assertEquals("A", (String) map.get(one)); ConcurrentNavigableMap empty = map0(); assertNull(empty.get(one)); }
/** replace value succeeds when the given key mapped to expected value */ public void testDescendingReplaceValue2() { ConcurrentNavigableMap map = dmap5(); assertEquals("A", map.get(m1)); assertTrue(map.replace(m1, "A", "Z")); assertEquals("Z", map.get(m1)); }
/** get returns the correct element at the given key, or null if not present */ public void testDescendingGet() { ConcurrentNavigableMap map = dmap5(); assertEquals("A", (String) map.get(m1)); ConcurrentNavigableMap empty = dmap0(); assertNull(empty.get(m1)); }
/** replace value succeeds when the given key mapped to expected value */ public void testReplaceValue2() { ConcurrentNavigableMap map = map5(); assertEquals("A", map.get(one)); assertTrue(map.replace(one, "A", "Z")); assertEquals("Z", map.get(one)); }
/** replace succeeds if the key is already present */ public void testReplace2() { ConcurrentNavigableMap map = map5(); assertNotNull(map.replace(one, "Z")); assertEquals("Z", map.get(one)); }