コード例 #1
0
 /** replace(null, x, y) throws NPE */
 public void testReplaceValue_NullPointerException() {
   try {
     ConcurrentNavigableMap c = map5();
     c.replace(null, one, "whatever");
     shouldThrow();
   } catch (NullPointerException success) {
   }
 }
コード例 #2
0
 /** replace(null, x) throws NPE */
 public void testDescendingReplace_NullPointerException() {
   try {
     ConcurrentNavigableMap c = dmap5();
     c.replace(null, "whatever");
     shouldThrow();
   } catch (NullPointerException success) {
   }
 }
コード例 #3
0
 /** 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));
 }
コード例 #4
0
 /** replace fails when the given key is not present */
 public void testDescendingReplace() {
   ConcurrentNavigableMap map = dmap5();
   assertNull(map.replace(six, "Z"));
   assertFalse(map.containsKey(six));
 }
コード例 #5
0
 /** 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));
 }
コード例 #6
0
 /** replace succeeds if the key is already present */
 public void testReplace2() {
   ConcurrentNavigableMap map = map5();
   assertNotNull(map.replace(one, "Z"));
   assertEquals("Z", map.get(one));
 }