diff --git a/src/main/java/org/opentripplanner/model/Timetable.java b/src/main/java/org/opentripplanner/model/Timetable.java index 031e95e8870..269667ba98e 100644 --- a/src/main/java/org/opentripplanner/model/Timetable.java +++ b/src/main/java/org/opentripplanner/model/Timetable.java @@ -126,7 +126,7 @@ public TripTimes getTripTimes(Trip trip) { public TripTimes getTripTimes(FeedScopedId tripId) { for (TripTimes tt : tripTimes) { - if (tt.getTrip().getId() == tripId) { + if (tt.getTrip().getId().equals(tripId)) { return tt; } } diff --git a/src/test/java/org/opentripplanner/model/TimetableTest.java b/src/test/java/org/opentripplanner/model/TimetableTest.java index 07b44844291..9e6a7467dc5 100644 --- a/src/test/java/org/opentripplanner/model/TimetableTest.java +++ b/src/test/java/org/opentripplanner/model/TimetableTest.java @@ -66,6 +66,12 @@ public static void setUp() throws Exception { trip_1_1_index = timetable.getTripIndex(new FeedScopedId(feedId, TRIP_ID)); } + @Test + public void getGetTripTimes() { + var tt = timetable.getTripTimes(new FeedScopedId(feedId, TRIP_ID)); + assertNotNull(tt); + } + @Test public void tripNotFoundInPattern() { // non-existing trip