Skip to content

Commit

Permalink
Move constant speed test to a dedicated test class
Browse files Browse the repository at this point in the history
  • Loading branch information
vesameskanen committed Nov 21, 2024
1 parent 2202ba0 commit 48cac2e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 48cac2e

Please sign in to comment.