From 48cac2ea33cc823e51c6e3caf38f1ab22914e0ef Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 21 Nov 2024 13:01:20 +0200 Subject: [PATCH] Move constant speed test to a dedicated test class --- .../tagmapping/ConstantSpeedMapperTest.java | 23 +++++++++++++++++++ .../osm/tagmapping/FinlandMapperTest.java | 14 ----------- 2 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 application/src/test/java/org/opentripplanner/osm/tagmapping/ConstantSpeedMapperTest.java diff --git a/application/src/test/java/org/opentripplanner/osm/tagmapping/ConstantSpeedMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/ConstantSpeedMapperTest.java new file mode 100644 index 00000000000..6256044320d --- /dev/null +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/ConstantSpeedMapperTest.java @@ -0,0 +1,23 @@ +package org.opentripplanner.osm.tagmapping; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; +import org.opentripplanner.osm.model.OsmWithTags; + +public class ConstantSpeedMapperTest { + + @Test + public void constantSpeedCarRouting() { + OsmTagMapper osmTagMapper = new ConstantSpeedFinlandMapper(20f); + + var slowWay = new OsmWithTags(); + slowWay.addTag("highway", "residential"); + assertEquals(20f, osmTagMapper.getCarSpeedForWay(slowWay, true)); + + var fastWay = new OsmWithTags(); + fastWay.addTag("highway", "motorway"); + fastWay.addTag("maxspeed", "120 kmph"); + assertEquals(20f, osmTagMapper.getCarSpeedForWay(fastWay, true)); + } +} diff --git a/application/src/test/java/org/opentripplanner/osm/tagmapping/FinlandMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/FinlandMapperTest.java index 24b46a001d7..f8b07e06bf6 100644 --- a/application/src/test/java/org/opentripplanner/osm/tagmapping/FinlandMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/FinlandMapperTest.java @@ -226,20 +226,6 @@ public void testArea() { assertEquals(wayData.getPermission(), PEDESTRIAN_AND_BICYCLE); } - @Test - public void constantSpeedCarRouting() { - OsmTagMapper osmTagMapper = new ConstantSpeedFinlandMapper(20f); - - var slowWay = new OsmWithTags(); - slowWay.addTag("highway", "residential"); - assertEquals(20f, osmTagMapper.getCarSpeedForWay(slowWay, true)); - - var fastWay = new OsmWithTags(); - fastWay.addTag("highway", "motorway"); - fastWay.addTag("maxspeed", "120 kmph"); - assertEquals(20f, osmTagMapper.getCarSpeedForWay(fastWay, true)); - } - @Test public void serviceNoThroughTraffic() { var way = new OsmWay();