File tree Expand file tree Collapse file tree
street/src/test/java/org/opentripplanner/street/model/edge Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,8 +26,14 @@ class StreetElevationExtensionBuilderTest {
2626 new Coordinate (0 , 0 ),
2727 new Coordinate (1 , 1 ),
2828 };
29+ private static final Coordinate [] COORDINATES_ONE_POINT_TWICE = new Coordinate [] {
30+ new Coordinate (0 , 0 ),
31+ new Coordinate (0 , 0 ),
32+ };
2933 private static final PackedCoordinateSequence ELEVATION_PROFILE_TWO_POINTS =
3034 new PackedCoordinateSequence .Double (COORDINATES_TWO_POINTS , 2 );
35+ private static final PackedCoordinateSequence ELEVATION_PROFILE_ONE_POINT_TWICE =
36+ new PackedCoordinateSequence .Double (COORDINATES_ONE_POINT_TWICE , 2 );
3137
3238 private static final LineString GEOMETRY = GeometryUtils .getGeometryFactory ().createLineString (
3339 new Coordinate [] {
@@ -65,6 +71,16 @@ void testValidElevationProfile() {
6571 assertFalse (streetElevationExtension .isEmpty ());
6672 }
6773
74+ @ Test
75+ void testZeroLengthEdge () {
76+ StreetElevationExtensionBuilder seeb = new StreetElevationExtensionBuilder ()
77+ .withPermission (StreetTraversalPermission .ALL )
78+ .withDistanceInMeters (0 )
79+ .withElevationProfile (ELEVATION_PROFILE_ONE_POINT_TWICE );
80+ Optional <StreetElevationExtension > streetElevationExtension = seeb .build ();
81+ assertTrue (streetElevationExtension .isEmpty ());
82+ }
83+
6884 @ Test
6985 void testBuildFromStreetEdge () {
7086 StreetEdge se = streetEdgeBuilder .buildAndConnect ();
You can’t perform that action at this time.
0 commit comments