Changeset 11061 in josm for trunk/test/unit/org
- Timestamp:
- 2016-09-27T20:47:19+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/corrector/ReverseWayTagCorrectorTest.java
r10945 r11061 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.corrector; 3 4 import java.util.Collections; 5 import java.util.List; 6 import java.util.Map; 7 import java.util.stream.Stream; 3 8 4 9 import org.junit.Assert; 5 10 import org.junit.Rule; 6 11 import org.junit.Test; 12 import org.openstreetmap.josm.data.correction.TagCorrection; 13 import org.openstreetmap.josm.data.osm.Node; 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 import org.openstreetmap.josm.data.osm.OsmUtils; 7 16 import org.openstreetmap.josm.data.osm.Tag; 17 import org.openstreetmap.josm.data.osm.Way; 8 18 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 19 … … 39 49 assertSwitch(new Tag(k, "something"), new Tag(k, "something")); 40 50 } 51 // direction=forward/backward/... 52 assertSwitch(new Tag("direction", "forward"), new Tag("direction", "backward")); 53 assertSwitch(new Tag("direction", "backward"), new Tag("direction", "forward")); 54 assertSwitch(new Tag("direction", "north"), new Tag("direction", "south")); 55 assertSwitch(new Tag("direction", "NNE"), new Tag("direction", "SSW")); 56 assertSwitch(new Tag("direction", "270"), new Tag("direction", "90")); 57 assertSwitch(new Tag("direction", "135"), new Tag("direction", "315")); 58 assertSwitch(new Tag("direction", "337"), new Tag("direction", "157")); 41 59 // :left/:right with oneway (see #10977) 42 60 assertSwitch(new Tag("cycleway:left:oneway", "-1"), new Tag("cycleway:right:oneway", "yes")); … … 99 117 Assert.assertEquals(ReverseWayTagCorrector.TagSwitcher.apply(oldTag), newTag); 100 118 } 119 120 /** 121 * Test tag correction on way nodes 122 */ 123 @Test 124 public void testSwitchingWayNodes() { 125 final OsmPrimitive n1 = OsmUtils.createPrimitive("node"); 126 final OsmPrimitive n2 = OsmUtils.createPrimitive("node direction=SSW"); 127 final OsmPrimitive n3 = OsmUtils.createPrimitive("node"); 128 final Way w = new Way(); 129 Stream.of(n1, n2, n3).map(Node.class::cast).forEach(w::addNode); 130 final Map<OsmPrimitive, List<TagCorrection>> tagCorrections = ReverseWayTagCorrector.getTagCorrectionsMap(w); 131 Assert.assertEquals(1, tagCorrections.size()); 132 Assert.assertEquals(Collections.singleton(n2), 133 tagCorrections.keySet()); 134 Assert.assertEquals(Collections.singletonList(new TagCorrection("direction", "SSW", "direction", "NNE")), 135 tagCorrections.values().iterator().next()); 136 } 101 137 }
Note:
See TracChangeset
for help on using the changeset viewer.