camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r897103 - /camel/trunk/camel-core/src/test/java/org/apache/camel/util/CaseInsensitiveMapTest.java
Date Fri, 08 Jan 2010 05:45:15 GMT
Author: davsclaus
Date: Fri Jan  8 05:45:11 2010
New Revision: 897103

URL: http://svn.apache.org/viewvc?rev=897103&view=rev
Log:
Added more tests for CaseInsensitiveMap based on user forum questions

Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/util/CaseInsensitiveMapTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/util/CaseInsensitiveMapTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/util/CaseInsensitiveMapTest.java?rev=897103&r1=897102&r2=897103&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/util/CaseInsensitiveMapTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/util/CaseInsensitiveMapTest.java
Fri Jan  8 05:45:11 2010
@@ -309,4 +309,44 @@
         assertTrue(testMapCopy.containsKey("key"));
     }
 
+    public void testCopyToAnotherMapPreserveKeyCaseEntrySet() {
+        Map<String, Object> map = new CaseInsensitiveMap();
+        map.put("Foo", "cheese");
+        map.put("BAR", "cake");
+        assertEquals(2, map.size());
+        assertEquals(true, map.containsKey("foo"));
+        assertEquals(true, map.containsKey("bar"));
+
+        Map<String, Object> other = new HashMap<String, Object>();
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
+            String key = entry.getKey();
+            Object value = entry.getValue();
+            other.put(key, value);
+        }
+
+        assertEquals(false, other.containsKey("foo"));
+        assertEquals(true, other.containsKey("Foo"));
+        assertEquals(false, other.containsKey("bar"));
+        assertEquals(true, other.containsKey("BAR"));
+        assertEquals(2, other.size());
+    }
+
+    public void testCopyToAnotherMapPreserveKeyCasePutAll() {
+        Map<String, Object> map = new CaseInsensitiveMap();
+        map.put("Foo", "cheese");
+        map.put("BAR", "cake");
+        assertEquals(2, map.size());
+        assertEquals(true, map.containsKey("foo"));
+        assertEquals(true, map.containsKey("bar"));
+
+        Map<String, Object> other = new HashMap<String, Object>();
+        other.putAll(map);
+
+        assertEquals(false, other.containsKey("foo"));
+        assertEquals(true, other.containsKey("Foo"));
+        assertEquals(false, other.containsKey("bar"));
+        assertEquals(true, other.containsKey("BAR"));
+        assertEquals(2, other.size());
+    }
+
 }
\ No newline at end of file



Mime
View raw message