From 19cba76fc89b0ec6c4dd9c956d8ddbaed25373fd Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Tue, 10 Sep 2024 22:05:47 +0200 Subject: [PATCH] Remove method only used in tests --- .../opentripplanner/ext/flex/FlexIntegrationTest.java | 9 +++++---- .../org/opentripplanner/ext/flex/FlexibleTransitLeg.java | 5 ----- src/main/java/org/opentripplanner/model/plan/Leg.java | 9 --------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java b/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java index c88439a9e3f..0d774a5b2a5 100644 --- a/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java +++ b/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.routing.api.request.StreetMode.FLEXIBLE; import static org.opentripplanner.street.search.TraverseMode.WALK; @@ -96,7 +97,7 @@ void shouldReturnARouteTransferringFromBusToFlex() { var flex = itin.getTransitLeg(3); assertEquals(BUS, flex.getMode()); assertEquals("Zone 2", flex.getRoute().getShortName()); - assertTrue(flex.isFlexibleTrip()); + assertInstanceOf(FlexibleTransitLeg.class, flex); assertEquals( "corner of Story Place Southwest and service road (part of Flex Zone 2)", flex.getFrom().name.toString() @@ -132,7 +133,7 @@ void shouldReturnARouteWithTwoTransfers() { var finalFlex = itin.getTransitLeg(4); assertEquals(BUS, finalFlex.getMode()); assertEquals("Zone 2", finalFlex.getRoute().getShortName()); - assertTrue(finalFlex.isFlexibleTrip()); + assertInstanceOf(FlexibleTransitLeg.class, finalFlex); assertEquals("2021-12-02T15:00-05:00[America/New_York]", finalFlex.getStartTime().toString()); assertEquals("2021-12-02T15:30-05:00[America/New_York]", finalFlex.getEndTime().toString()); } @@ -151,7 +152,7 @@ void flexDirect() { "Should contain only flex itineraries" ); - var itin = itineraries.get(0); + var itin = itineraries.getFirst(); // walk, flex assertEquals(2, itin.getLegs().size()); @@ -164,7 +165,7 @@ void flexDirect() { var flex = itin.getTransitLeg(1); assertEquals(BUS, flex.getMode()); assertEquals("Zone 2", flex.getRoute().getShortName()); - assertTrue(flex.isFlexibleTrip()); + assertInstanceOf(FlexibleTransitLeg.class, flex); assertEquals("Transfer Point for Route 30", flex.getFrom().name.toString()); assertEquals("Destination (part of Flex Zone 2)", flex.getTo().name.toString()); diff --git a/src/ext/java/org/opentripplanner/ext/flex/FlexibleTransitLeg.java b/src/ext/java/org/opentripplanner/ext/flex/FlexibleTransitLeg.java index 0544a46da72..248d8ad7ae1 100644 --- a/src/ext/java/org/opentripplanner/ext/flex/FlexibleTransitLeg.java +++ b/src/ext/java/org/opentripplanner/ext/flex/FlexibleTransitLeg.java @@ -111,11 +111,6 @@ public ZonedDateTime getEndTime() { return endTime; } - @Override - public boolean isFlexibleTrip() { - return true; - } - @Override public double getDistanceMeters() { return DoubleUtils.roundTo2Decimals(edge.getDistanceMeters()); diff --git a/src/main/java/org/opentripplanner/model/plan/Leg.java b/src/main/java/org/opentripplanner/model/plan/Leg.java index 2a0b6726560..54d5dbc41c6 100644 --- a/src/main/java/org/opentripplanner/model/plan/Leg.java +++ b/src/main/java/org/opentripplanner/model/plan/Leg.java @@ -244,15 +244,6 @@ default boolean getRealTime() { return false; } - /** - * Whether this Leg describes a flexible trip. The reason we need this is that FlexTrip does not - * inherit from Trip, so that the information that the Trip is flexible would be lost when - * creating this object. - */ - default boolean isFlexibleTrip() { - return false; - } - /** * Is this a frequency-based trip with non-strict departure times? */