scolebourne 2004/02/26 16:25:14 Modified: collections/src/test/org/apache/commons/collections/map TestCaseInsensitiveMap.java TestIdentityMap.java TestLRUMap.java TestHashedMap.java TestLinkedMap.java Log: Test cloning of maps works correctly
bug 27159, identified by Fabrizio Giustina Revision Changes Path 1.4 +9 -1 jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java Index: TestCaseInsensitiveMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestCaseInsensitiveMap.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestCaseInsensitiveMap.java 18 Feb 2004 01:20:38 -0000 1.3 +++ TestCaseInsensitiveMap.java 27 Feb 2004 00:25:14 -0000 1.4 @@ -100,6 +100,14 @@ assertEquals(caseInsensitiveMap.get(null), "Four"); } + public void testClone() { + CaseInsensitiveMap map = new CaseInsensitiveMap(10); + map.put("1", "1"); + Map cloned = (Map) map.clone(); + assertEquals(map.size(), cloned.size()); + assertSame(map.get("1"), cloned.get("1")); + } + /* public void testCreate() throws Exception { resetEmpty(); 1.7 +9 -1 jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestIdentityMap.java Index: TestIdentityMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestIdentityMap.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestIdentityMap.java 18 Feb 2004 01:20:38 -0000 1.6 +++ TestIdentityMap.java 27 Feb 2004 00:25:14 -0000 1.7 @@ -125,6 +125,14 @@ } } + public void testClone() { + IdentityMap map = new IdentityMap(10); + map.put("1", "1"); + Map cloned = (Map) map.clone(); + assertEquals(map.size(), cloned.size()); + assertSame(map.get("1"), cloned.get("1")); + } + // public void testCreate() throws Exception { // Map map = new IdentityMap(); // writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/IdentityMap.emptyCollection.version3.obj"); 1.6 +9 -1 jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestLRUMap.java Index: TestLRUMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestLRUMap.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestLRUMap.java 18 Feb 2004 01:20:38 -0000 1.5 +++ TestLRUMap.java 27 Feb 2004 00:25:14 -0000 1.6 @@ -210,6 +210,14 @@ assertSame(values[3], it.next()); } + public void testClone() { + LRUMap map = new LRUMap(10); + map.put("1", "1"); + Map cloned = (Map) map.clone(); + assertEquals(map.size(), cloned.size()); + assertSame(map.get("1"), cloned.get("1")); + } + // public void testCreate() throws Exception { // resetEmpty(); // writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/LRUMap.emptyCollection.version3.obj"); 1.7 +9 -1 jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestHashedMap.java Index: TestHashedMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestHashedMap.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestHashedMap.java 18 Feb 2004 01:20:38 -0000 1.6 +++ TestHashedMap.java 27 Feb 2004 00:25:14 -0000 1.7 @@ -51,6 +51,14 @@ return "3"; } + public void testClone() { + HashedMap map = new HashedMap(10); + map.put("1", "1"); + Map cloned = (Map) map.clone(); + assertEquals(map.size(), cloned.size()); + assertSame(map.get("1"), cloned.get("1")); + } + // public void testCreate() throws Exception { // resetEmpty(); // writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/HashedMap.emptyCollection.version3.obj"); 1.7 +9 -1 jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestLinkedMap.java Index: TestLinkedMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestLinkedMap.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestLinkedMap.java 18 Feb 2004 01:20:38 -0000 1.6 +++ TestLinkedMap.java 27 Feb 2004 00:25:14 -0000 1.7 @@ -255,6 +255,14 @@ } + public void testClone() { + LinkedMap map = new LinkedMap(10); + map.put("1", "1"); + Map cloned = (Map) map.clone(); + assertEquals(map.size(), cloned.size()); + assertSame(map.get("1"), cloned.get("1")); + } + // public void testCreate() throws Exception { // resetEmpty(); // writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/LinkedMap.emptyCollection.version3.obj"); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]