Skip to content

Commit 7a96e1a

Browse files
committed
add test for #6391
1 parent 4c3983b commit 7a96e1a

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

application/src/test/java/org/opentripplanner/updater/trip/TripUpdateBuilder.java

+20
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ public TripUpdateBuilder addDelayedStopTime(int stopSequence, int delay) {
6565
return addStopTime(null, -1, stopSequence, delay, delay, DEFAULT_SCHEDULE_RELATIONSHIP, null);
6666
}
6767

68+
public TripUpdateBuilder addDelayedArrivalStopTime(int stopSequence, int arrivalDelay) {
69+
return addStopTime(
70+
null,
71+
-1,
72+
stopSequence,
73+
arrivalDelay,
74+
NO_DELAY,
75+
DEFAULT_SCHEDULE_RELATIONSHIP,
76+
null
77+
);
78+
}
79+
6880
public TripUpdateBuilder addDelayedStopTime(
6981
int stopSequence,
7082
int arrivalDelay,
@@ -166,6 +178,14 @@ private TripUpdateBuilder addStopTime(
166178
departureBuilder.setDelay(departureDelay);
167179
}
168180

181+
if (!arrivalBuilder.hasTime() && !arrivalBuilder.hasDelay()) {
182+
stopTimeUpdateBuilder.clearArrival();
183+
}
184+
185+
if (!departureBuilder.hasTime() && !departureBuilder.hasDelay()) {
186+
stopTimeUpdateBuilder.clearDeparture();
187+
}
188+
169189
return this;
170190
}
171191

application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/DelayedTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void complexDelay() {
8383
var tripUpdate = new TripUpdateBuilder(TRIP_2_ID, SERVICE_DATE, SCHEDULED, TIME_ZONE)
8484
.addDelayedStopTime(0, 0)
8585
.addDelayedStopTime(1, 60, 80)
86-
.addDelayedStopTime(2, 90, 90)
86+
.addDelayedArrivalStopTime(2, 90) // must be greater than the dwell time
8787
.build();
8888

8989
assertSuccess(env.applyTripUpdate(tripUpdate));
@@ -123,7 +123,7 @@ void complexDelay() {
123123
env.getScheduledTimetable(TRIP_2_ID)
124124
);
125125
assertEquals(
126-
"UPDATED | A1 0:01 0:01:01 | B1 0:02:10 0:02:31 | C1 0:02:50 0:02:51",
126+
"UPDATED | A1 0:01 0:01:01 | B1 0:02:10 0:02:31 | C1 0:02:50 0:02:50",
127127
env.getRealtimeTimetable(TRIP_2_ID)
128128
);
129129
}

0 commit comments

Comments
 (0)