Changeset 8265 in josm for trunk/test/unit/org
- Timestamp:
- 2015-04-25T18:33:40+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
r7937 r8265 8 8 9 9 import java.io.StringReader; 10 import java.util.Iterator; 10 11 import java.util.LinkedHashSet; 11 12 import java.util.List; … … 17 18 import org.openstreetmap.josm.Main; 18 19 import org.openstreetmap.josm.command.ChangePropertyCommand; 20 import org.openstreetmap.josm.command.ChangePropertyKeyCommand; 21 import org.openstreetmap.josm.command.Command; 22 import org.openstreetmap.josm.command.PseudoCommand; 23 import org.openstreetmap.josm.command.SequenceCommand; 19 24 import org.openstreetmap.josm.data.osm.Node; 20 import org.openstreetmap.josm.data.osm.Tag; 25 import org.openstreetmap.josm.data.osm.OsmPrimitive; 26 import org.openstreetmap.josm.data.osm.OsmUtils; 21 27 import org.openstreetmap.josm.data.validation.Severity; 22 28 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.TagCheck; … … 49 55 assertThat(check, notNullValue()); 50 56 assertThat(check.getDescription(null), is("{0.key}=null is deprecated")); 51 assertThat(check. change.get(0).apply(null), is(new Tag("{0.key}")));52 assertThat(check. change.get(1).apply(null), is(new Tag("natural", "wetland")));53 assertThat(check. change.get(2).apply(null), is(new Tag("wetland", "marsh")));57 assertThat(check.fixCommands.get(0).toString(), is("fixRemove: {0.key}")); 58 assertThat(check.fixCommands.get(1).toString(), is("fixAdd: natural=wetland")); 59 assertThat(check.fixCommands.get(2).toString(), is("fixAdd: wetland=marsh")); 54 60 final Node n1 = new Node(); 55 61 n1.put("natural", "marsh"); … … 65 71 assertThat(MapCSSTagChecker.TagCheck.insertArguments(check.rule.selectors.get(0), "The key is {0.key} and the value is {0.value}"), 66 72 is("The key is natural and the value is marsh")); 73 } 74 75 @Test 76 public void test10913() throws Exception { 77 final OsmPrimitive p = OsmUtils.createPrimitive("way highway=tertiary construction=yes"); 78 final TagCheck check = TagCheck.readMapCSS(new StringReader("way {" + 79 "throwError: \"error\";" + 80 "fixChangeKey: \"highway => construction\";\n" + 81 "fixAdd: \"highway=construction\";\n" + 82 "}")).get(0); 83 final Command command = check.fixPrimitive(p); 84 assertThat(command instanceof SequenceCommand, is(true)); 85 final Iterator<PseudoCommand> it = command.getChildren().iterator(); 86 assertThat(it.next() instanceof ChangePropertyKeyCommand, is(true)); 87 assertThat(it.next() instanceof ChangePropertyCommand, is(true)); 67 88 } 68 89
Note:
See TracChangeset
for help on using the changeset viewer.