Skip to content

Commit

Permalink
Flesh out test
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Jan 28, 2025
1 parent 4cb922f commit 1f2c3ab
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ public class OsmNode extends OsmWithTags {
public double lat;
public double lon;

public OsmNode() {}

public OsmNode(double lat, double lon) {
this.lat = lat;
this.lon = lon;
}

public String toString() {
return "osm node " + id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.opentripplanner.framework.i18n.NonLocalizedString;
import org.opentripplanner.osm.DefaultOsmProvider;
import org.opentripplanner.osm.OsmProvider;
import org.opentripplanner.osm.model.OsmNode;
import org.opentripplanner.osm.model.OsmWay;
import org.opentripplanner.osm.model.OsmWithTags;
import org.opentripplanner.osm.tagmapping.OsmTagMapper;
Expand Down Expand Up @@ -180,11 +181,28 @@ void testCrappyOsmPlatform() {
var provider = new OsmProvider() {
@Override
public void readOsm(OsmDatabase osmdb) {
final OsmWay way = new OsmWay();

var way = new OsmWay();
way.addTag("public_transport", "platform");
way.addTag("access", "no");
way.addTag("motor_vehicle", "permissive");
way.addTag("ref", "123");
way.addTag("oneway", "yes");
way.setOsmProvider(this);
way.getNodeRefs().add(1);
way.getNodeRefs().add(2);
osmdb.addWay(way);

osmdb.doneSecondPhaseWays();

var node1 = new OsmNode(1,1);
node1.setId(1);
var node2 = new OsmNode(1.1,1.1);
node2.setId(2);

osmdb.addNode(node1);
osmdb.addNode(node2);

}

@Override
Expand Down Expand Up @@ -219,6 +237,7 @@ public ZoneId getZoneId() {
)
.withBoardingAreaRefTags(Set.of("naptan:AtcoCode"))
.build();

osmModule.buildGraph();
assertThat(graph.getEdges()).isNotEmpty();
}
Expand Down

0 comments on commit 1f2c3ab

Please sign in to comment.