camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r922157 - /camel/trunk/camel-core/src/test/java/org/apache/camel/util/CaseInsensitiveMapTest.java
Date Fri, 12 Mar 2010 07:13:49 GMT
Author: davsclaus
Date: Fri Mar 12 07:13:49 2010
New Revision: 922157

URL: http://svn.apache.org/viewvc?rev=922157&view=rev
Log:
Added another test

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=922157&r1=922156&r2=922157&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 Mar 12 07:13:49 2010
@@ -366,4 +366,28 @@ public class CaseInsensitiveMapTest exte
         assertEquals(2, other.size());
     }
 
+    public void testCopyToAnotherMapPreserveKeyKeySet() {
+        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>();
+
+        // this is wrong!!! you should use entrySet
+        for (String key : map.keySet()) {
+            Object value = map.get(key);
+            other.put(key, value);
+        }
+
+        // now the keys will be in lower case
+        assertEquals(true, other.containsKey("foo"));
+        assertEquals(false, other.containsKey("Foo"));
+        assertEquals(true, other.containsKey("bar"));
+        assertEquals(false, other.containsKey("BAR"));
+        assertEquals(2, other.size());
+    }
+
 }
\ No newline at end of file



Mime
View raw message