From cef1fd52646aa663a4382c989ff023b0684b43a0 Mon Sep 17 00:00:00 2001 From: Henrik Abrahamsson Date: Tue, 21 May 2024 15:33:43 +0200 Subject: [PATCH] Fix comparison of feedId --- src/main/java/org/opentripplanner/model/Timetable.java | 2 +- src/test/java/org/opentripplanner/model/TimetableTest.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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