/** replace(null, x, y) throws NPE */ public void testReplaceValue_NullPointerException() { try { ConcurrentNavigableMap c = map5(); c.replace(null, one, "whatever"); shouldThrow(); } catch (NullPointerException success) { } }
/** replace(null, x) throws NPE */ public void testDescendingReplace_NullPointerException() { try { ConcurrentNavigableMap c = dmap5(); c.replace(null, "whatever"); shouldThrow(); } catch (NullPointerException success) { } }
/** 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)); }
/** replace fails when the given key is not present */ public void testDescendingReplace() { ConcurrentNavigableMap map = dmap5(); assertNull(map.replace(six, "Z")); assertFalse(map.containsKey(six)); }
/** 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)); }