harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r483366 - in /harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util: IdentityHashMap2Test.java IdentityHashMapTest.java
Date Thu, 07 Dec 2006 07:16:41 GMT
Author: smishura
Date: Wed Dec  6 23:16:40 2006
New Revision: 483366

URL: http://svn.apache.org/viewvc?view=rev&rev=483366
Log:
Merge tests to one file

Removed:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IdentityHashMapTest.java
Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IdentityHashMap2Test.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IdentityHashMap2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IdentityHashMap2Test.java?view=diff&rev=483366&r1=483365&r2=483366
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IdentityHashMap2Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/util/IdentityHashMap2Test.java
Wed Dec  6 23:16:40 2006
@@ -89,6 +89,23 @@
 				map.get(null));
 	}
 
+    /**
+     * @tests java.util.IdentityHashMap#put(java.lang.Object, java.lang.Object)
+     */
+    public void test_putLjava_lang_ObjectLjava_lang_Object() {
+        IdentityHashMap<Object, Object> map = new IdentityHashMap<Object, Object>();
+        
+        // Test null as a key.
+        Object value = "Some value";
+        map.put(null, value);
+        assertSame("Assert 0: Failure getting null key", value, map.get(null));
+        
+        // Test null as a value
+        Object key = "Some key";
+        map.put(key, null);
+        assertNull("Assert 1: Failure getting null value", map.get(key));
+    }
+
 	/**
 	 * @tests java.util.IdentityHashMap#remove(java.lang.Object)
 	 * @tests java.util.IdentityHashMap#keySet()
@@ -108,6 +125,25 @@
 				&& map.get("key2") == "value2");
 		assertNull("Modified null entry", map.get(null));
 	}
+
+    /**
+     * @tests java.util.IdentityHashMapTest#remove(java.lang.Object)
+     */
+    public void test_removeLjava_lang_Object() {
+        // Regression for HARMONY-37
+        IdentityHashMap<String, String> hashMap = new IdentityHashMap<String, String>();
+        hashMap.remove("absent");
+        assertEquals("Assert 0: Size is incorrect", 0, hashMap.size());
+
+        hashMap.put("key", "value");
+        hashMap.remove("key");
+        assertEquals("Assert 1: After removing non-null element size is incorrect", 0, hashMap.size());
+
+        hashMap.put(null, null);
+        assertEquals("Assert 2: adding literal null failed", 1, hashMap.size());
+        hashMap.remove(null);
+        assertEquals("Assert 3: After removing null element size is incorrect", 0, hashMap.size());
+    }
 
 	/**
 	 * @tests java.util.IdentityHashMap#entrySet()



Mime
View raw message