| 56 | } // testPutAndGet() |
| 57 | |
| 58 | public void testSubsume() throws Exception { |
| 59 | assertTrue(true); |
| 60 | SimpleFeatureMapImpl map = new SimpleFeatureMapImpl(); |
| 61 | SimpleFeatureMapImpl map2 = new SimpleFeatureMapImpl(); |
| 62 | map.put("1", "bala"); |
| 63 | map2.put("1", map.get("1")); |
| 64 | |
| 65 | map.put("2", "20"); |
| 66 | /** |
| 67 | * test1: |
| 68 | * subsume partially - map1 and map2 has one common element |
| 69 | */ |
| 70 | assertTrue(map.subsumes(map2)); |
| 71 | /** |
| 72 | * test 2: |
| 73 | * map2 do NOT subsumes map1 |
| 74 | */ |
| 75 | assertTrue(!map2.subsumes(map)); |
| 76 | /** |
| 77 | * Test 3: |
| 78 | * subsume partially - map1 and map2.keySet() |
| 79 | */ |
| 80 | assertTrue(map.subsumes(map2, map2.keySet())); |
| 81 | /** |
| 82 | * test 4: |
| 83 | * map2 SUBSUMES and map using the map2.keySet() |
| 84 | */ |
| 85 | assertTrue(map2.subsumes(map, map2.keySet())); |
| 86 | |
| 87 | /** |
| 88 | * test 5,6,7,8: |
| 89 | * test1,2,3,4 with NULL's in the map and |
| 90 | * not NULL's the map2 under the same key "3" |
| 91 | */ |
| 92 | map.put("3", null); |
| 93 | map2.put("3", "not null"); |
| 94 | |
| 95 | assertTrue(!map.subsumes(map2)); |
| 96 | assertTrue(!map2.subsumes(map)); |
| 97 | assertTrue(!map.subsumes(map2, map2.keySet())); |
| 98 | assertTrue(!map2.subsumes(map, map2.keySet())); |
| 99 | |
| 100 | /** |
| 101 | * Test 9,10,11,12 repeat the same test but with compatible (null) values |
| 102 | * under the same key "3" |
| 103 | */ |
| 104 | map2.put("3", null); |
| 105 | |
| 106 | assertTrue(map.subsumes(map2)); |
| 107 | assertTrue(!map2.subsumes(map)); |
| 108 | assertTrue(map.subsumes(map2, map2.keySet())); |
| 109 | assertTrue(map2.subsumes(map, map2.keySet())); |
| 110 | |
| 111 | /** |
| 112 | * Test 13,14,15,16 repeat the same test but with null keys in the two of the maps |
| 113 | */ |
| 114 | map.put(null, "5"); |
| 115 | map2.put(null, "5"); |