Changeset 18890 in josm for trunk/test/unit
- Timestamp:
- 2023-10-31T19:06:59+01:00 (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/AbstractPrimitiveTest.java
r18853 r18890 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit.jupiter.api.Assertions.assertEquals; 4 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertNull; 5 7 import static org.junit.jupiter.api.Assertions.assertTrue; 6 8 7 9 import java.util.Collections; 10 import java.util.HashMap; 11 import java.util.Map; 8 12 9 13 import org.junit.jupiter.api.Test; 14 import org.openstreetmap.josm.TestUtils; 10 15 11 16 /** … … 66 71 assertTrue(p.hasTagDifferent("foo", Collections.singleton("bar"))); 67 72 } 73 74 /** 75 * Unit test of {@link AbstractPrimitive#putAll} 76 */ 77 @Test 78 void testPutAllInsert() { 79 AbstractPrimitive p = new Node(); 80 Map<String, String> tags = new HashMap<>(); 81 82 tags.put("a", "va1"); 83 tags.put("b", "vb1"); 84 p.putAll(tags); 85 assertEquals("va1", p.get("a")); 86 assertEquals("vb1", p.get("b")); 87 88 } 89 90 /** 91 * Unit test of {@link AbstractPrimitive#putAll} 92 */ 93 @Test 94 void testPutAllChange() { 95 AbstractPrimitive p = TestUtils.newNode("a=va1 b=vb1"); 96 Map<String, String> tags = new HashMap<>(); 97 98 tags.put("a", "va2"); 99 p.putAll(tags); 100 assertEquals("va2", p.get("a")); 101 assertEquals("vb1", p.get("b")); 102 } 103 104 /** 105 * Unit test of {@link AbstractPrimitive#putAll} 106 */ 107 @Test 108 void testPutAllChangeAndInsert() { 109 AbstractPrimitive p = TestUtils.newNode("a=va2 b=vb1"); 110 Map<String, String> tags = new HashMap<>(); 111 112 tags.put("b", "vb3"); 113 tags.put("c", "vc3"); 114 p.putAll(tags); 115 assertEquals("va2", p.get("a")); 116 assertEquals("vb3", p.get("b")); 117 assertEquals("vc3", p.get("c")); 118 } 119 120 /** 121 * Unit test of {@link AbstractPrimitive#putAll} 122 */ 123 @Test 124 void testPutAllChangeAndRemove() { 125 AbstractPrimitive p = TestUtils.newNode("a=va2 b=vb3 c=vc3"); 126 Map<String, String> tags = new HashMap<>(); 127 128 tags.put("a", "va4"); 129 tags.put("b", null); 130 tags.put(null, null); 131 p.putAll(tags); 132 assertEquals("va4", p.get("a")); 133 assertNull(p.get("b")); 134 assertEquals("vc3", p.get("c")); 135 } 68 136 }
Note:
See TracChangeset
for help on using the changeset viewer.