/**
* @tests java.util.IdentityHashMap#clone()
*/
public void test_clone() {
// Test for method java.lang.Object java.util.IdentityHashMap.clone()
IdentityHashMap hm2 = (IdentityHashMap) hm.clone();
assertTrue("Clone answered equivalent IdentityHashMap", hm2 != hm);
for (int counter = 0; counter < hmSize; counter++)
assertTrue("Clone answered unequal IdentityHashMap", hm
.get(objArray2[counter]) == hm2.get(objArray2[counter]));
IdentityHashMap map = new IdentityHashMap();
map.put("key", "value");
// get the keySet() and values() on the original Map
Set keys = map.keySet();
Collection values = map.values();
assertEquals("values() does not work",
"value", values.iterator().next());
assertEquals("keySet() does not work",
"key", keys.iterator().next());
AbstractMap map2 = (AbstractMap) map.clone();
map2.put("key", "value2");
Collection values2 = map2.values();
assertTrue("values() is identical", values2 != values);
// values() and keySet() on the cloned() map should be different
assertEquals("values() was not cloned",