assertTrue(map.get(key1) == replaced);
assertTrue(map.get(key2) == value);
}
public void testRemove() {
IdentityMap map = new IdentityMap();
Object key1 = new Integer(123);
Object key2 = new Integer(123);
Object key3 = new Integer(123);
map.put(key1, "value 1");
map.put(key2, "value 2");
map.put(key3, "value 3");
assertTrue(map.size() == 3);
assertTrue(map.containsKey(key1));
assertTrue(map.containsKey(key2));
assertTrue(map.containsKey(key3));
map.remove(key2);
assertTrue(map.size() == 2);
assertTrue(map.containsKey(key1));
assertFalse(map.containsKey(key2));
assertTrue(map.containsKey(key3));
map.remove(key3);
assertTrue(map.size() == 1);
assertTrue(map.containsKey(key1));
assertFalse(map.containsKey(key2));
assertFalse(map.containsKey(key3));
map.remove(key1);
assertTrue(map.size() == 0);
assertFalse(map.containsKey(key1));
assertFalse(map.containsKey(key2));
assertFalse(map.containsKey(key3));
}