File tree Expand file tree Collapse file tree
application/src/test/java/org/opentripplanner/transit/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org .opentripplanner .transit .service ;
22
3+ import static com .google .common .truth .Truth .assertThat ;
34import static org .junit .jupiter .api .Assertions .assertEquals ;
45import static org .junit .jupiter .api .Assertions .assertFalse ;
56import static org .opentripplanner .transit .model .basic .TransitMode .BUS ;
@@ -277,18 +278,23 @@ void getRealtimeTripTimesForAddedTripOnNoServiceDay() {
277278
278279 @ Test
279280 void testFromTripTimesWithScheduleFallback () {
280- TripPattern tripPattern = service .findPattern (TRIP );
281- Timetable timetable = service .findTimetable (tripPattern , SERVICE_DATE );
281+ TripPattern tripPattern = service .findPattern (BAD_TRIP );
282+ // Construct a timetable which definitely does not contain this trip, because it is empty.
283+ Timetable timetable = Timetable .of ().withTripPattern (tripPattern ).withServiceDate (SERVICE_DATE ).build ();
282284 Instant midnight = ServiceDateUtils .asStartOfService (
283285 SERVICE_DATE ,
284286 service .getTimeZone ()
285287 ).toInstant ();
286- var tripTimeOnDate = TripTimeOnDate .fromTripTimesWithScheduleFallback (
288+ var tripTimeOnDates = TripTimeOnDate .fromTripTimesWithScheduleFallback (
287289 timetable ,
288290 TRIP ,
289291 SERVICE_DATE ,
290292 midnight ,
291293 service
292294 );
295+ for (var tripTimeOnDate : tripTimeOnDates ) {
296+ assertThat (tripTimeOnDate .getServiceDay ()).isNull ();
297+ assertThat (tripTimeOnDate .getServiceDayMidnight ()).isEqualTo (TripTimeOnDate .UNDEFINED );
298+ }
293299 }
294300}
You can’t perform that action at this time.
0 commit comments