assertTrue(map.contains(key1));
assertTrue(map.contains(key2));
}
public void testRemove() {
IdentitySet set = new IdentitySet();
Object key1 = new Integer(123);
Object key2 = new Integer(123);
Object key3 = new Integer(123);
set.add(key1);
set.add(key2);
set.add(key3);
assertTrue(set.size() == 3);
assertTrue(set.contains(key1));
assertTrue(set.contains(key2));
assertTrue(set.contains(key3));
set.remove(key2);
assertTrue(set.size() == 2);
assertTrue(set.contains(key1));
assertFalse(set.contains(key2));
assertTrue(set.contains(key3));
set.remove(key3);
assertTrue(set.size() == 1);
assertTrue(set.contains(key1));
assertFalse(set.contains(key2));
assertFalse(set.contains(key3));
set.remove(key1);
assertTrue(set.size() == 0);
assertFalse(set.contains(key1));
assertFalse(set.contains(key2));
assertFalse(set.contains(key3));
}