/** putIfAbsent(null, x) throws NPE */ public void testPutIfAbsent1_NullPointerException() { try { ConcurrentNavigableMap c = map5(); c.putIfAbsent(null, "whatever"); shouldThrow(); } catch (NullPointerException success) { } }
/** putIfAbsent does not add the pair if the key is already present */ public void testDescendingPutIfAbsent2() { ConcurrentNavigableMap map = dmap5(); assertEquals("A", map.putIfAbsent(m1, "Z")); }
/** putIfAbsent works when the given key is not present */ public void testDescendingPutIfAbsent() { ConcurrentNavigableMap map = dmap5(); map.putIfAbsent(six, "Z"); assertTrue(map.containsKey(six)); }
/** putIfAbsent does not add the pair if the key is already present */ public void testPutIfAbsent2() { ConcurrentNavigableMap map = map5(); assertEquals("A", map.putIfAbsent(one, "Z")); }