Skip to content

Commit

Permalink
add failing test for #6072
Browse files Browse the repository at this point in the history
  • Loading branch information
miklcct committed Oct 25, 2024
1 parent 440498f commit 372e4f0
Showing 1 changed file with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class TripPatternTest {

private static final Route ROUTE = TimetableRepositoryForTest.route("routeId").build();
public static final RegularStop STOP_A = TEST_MODEL.stop("A").build();
public static final RegularStop STOP_X = TEST_MODEL.stop("X").build();
public static final RegularStop STOP_B = TEST_MODEL.stop("B").build();
public static final RegularStop STOP_Y = TEST_MODEL.stop("Y").build();
public static final RegularStop STOP_C = TEST_MODEL.stop("C").build();
private static final StopPattern STOP_PATTERN = TimetableRepositoryForTest.stopPattern(
STOP_A,
Expand All @@ -33,8 +35,8 @@ class TripPatternTest {
);

private static final List<LineString> HOP_GEOMETRIES = List.of(
makeLineString(STOP_A.getCoordinate(), STOP_B.getCoordinate()),
makeLineString(STOP_B.getCoordinate(), STOP_C.getCoordinate())
makeLineString(STOP_A.getCoordinate(), STOP_X.getCoordinate(), STOP_B.getCoordinate()),
makeLineString(STOP_B.getCoordinate(), STOP_Y.getCoordinate(), STOP_C.getCoordinate())
);

private static final TripPattern subject = TripPattern
Expand Down Expand Up @@ -70,6 +72,27 @@ void copy() {
assertEquals(HOP_GEOMETRIES.get(1), copy.getHopGeometry(1));
}

@Test
void hopGeometryForReplacementPattern() {
var pattern = TripPattern
.of(id("replacement"))
.withName("replacement")
.withRoute(ROUTE)
.withStopPattern(TimetableRepositoryForTest.stopPattern(STOP_A, STOP_B, STOP_X, STOP_Y))
.withOriginalTripPattern(subject)
.build();

assertEquals(HOP_GEOMETRIES.get(0), pattern.getHopGeometry(0));
assertEquals(
makeLineString(STOP_B.getCoordinate(), STOP_X.getCoordinate()),
pattern.getHopGeometry(1)
);
assertEquals(
makeLineString(STOP_X.getCoordinate(), STOP_Y.getCoordinate()),
pattern.getHopGeometry(2)
);
}

@Test
void sameAs() {
assertTrue(subject.sameAs(subject.copy().build()));
Expand Down

0 comments on commit 372e4f0

Please sign in to comment.