From e092718f2fd060d158644c4ddce146cf9629a6e3 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Tue, 7 Sep 2021 08:22:55 -0600 Subject: [PATCH] RoutingIslands: Add highway=platform to exclusions See https://wiki.openstreetmap.org/wiki/Tag:highway%3Dplatform for tag information. Signed-off-by: Taylor Smock --- build.gradle | 2 ++ .../validation/tests/RoutingIslandsTest.java | 2 +- .../tests/RoutingIslandsTestTest.java | 25 +++++++++++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 3f570f6..3852592 100644 --- a/build.gradle +++ b/build.gradle @@ -165,11 +165,13 @@ jacocoTestCoverageVerification { spotless { java { licenseHeader "// License: GPL. For details, see LICENSE file." + ratchetFrom("origin/master") removeUnusedImports() endWithNewline() indentWithSpaces(4) eclipse().configFile "config/josm_formatting.xml" trimTrailingWhitespace() + importOrder("java", "javax", "") } } diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/RoutingIslandsTest.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/RoutingIslandsTest.java index 1fc634e..25fa351 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/RoutingIslandsTest.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/RoutingIslandsTest.java @@ -50,7 +50,7 @@ public class RoutingIslandsTest extends Test { private static final String HIGHWAY = "highway"; private static final String WATERWAY = "waterway"; - private static final List IGNORE_TAGS_HIGHWAY = Arrays.asList("services", "rest_area"); + private static final List IGNORE_TAGS_HIGHWAY = Arrays.asList("services", "rest_area", "platform"); private static final List IGNORE_TAGS_WATERWAY = Arrays.asList("services", "rest_area", "dam"); /** diff --git a/test/unit/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/RoutingIslandsTestTest.java b/test/unit/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/RoutingIslandsTestTest.java index bdcbfad..479e93d 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/RoutingIslandsTestTest.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/RoutingIslandsTestTest.java @@ -13,8 +13,11 @@ import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.openstreetmap.josm.TestUtils; import org.openstreetmap.josm.data.Bounds; import org.openstreetmap.josm.data.DataSource; @@ -26,8 +29,6 @@ import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.data.validation.Severity; import org.openstreetmap.josm.spi.preferences.Config; import org.openstreetmap.josm.testutils.JOSMTestRules; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import org.openstreetmap.josm.testutils.annotations.BasicPreferences; /** @@ -341,12 +342,32 @@ class RoutingIslandsTestTest { new Node(new LatLon(39.1055829, -108.5257975))); Way testPath = TestUtils.newWay("highway=footway", i70w.lastNode(true), i70e.firstNode(true)); DataSet ds = new DataSet(); + ds.addDataSource(new DataSource(new Bounds(-90, -180, 90, 180), "")); Arrays.asList(i70w, i70e, testPath).forEach(way -> addToDataSet(ds, way)); RoutingIslandsTest test = new RoutingIslandsTest(); test.startTest(null); test.visit(ds.allPrimitives()); test.endTest(); + assertFalse(test.getErrors().isEmpty()); + } + + @ParameterizedTest + @ValueSource(strings = { "highway=services", "highway=rest_area", "highway=platform", "waterway=services", + "waterway=rest_area", "waterway=dam" }) + void testExemptions(final String tag) { + final Way testWay = TestUtils.newWay(tag, new Node(new LatLon(39.1058104, -108.5258586)), + new Node(new LatLon(39.1052235, -108.5293733))); + final DataSet ds = new DataSet(); + ds.addDataSource(new DataSource(new Bounds(-90, -180, 90, 180), "")); + testWay.getNodes().forEach(ds::addPrimitive); + ds.addPrimitive(testWay); + + RoutingIslandsTest test = new RoutingIslandsTest(); + test.startTest(null); + test.visit(ds.allPrimitives()); + test.endTest(); + assertTrue(test.getErrors().isEmpty()); } private static void addToDataSet(DataSet ds, OsmPrimitive primitive) {