diff --git a/src/test/java/org/opentripplanner/transit/raptor/speed_test/model/testcase/CsvFileIO.java b/src/test/java/org/opentripplanner/transit/raptor/speed_test/model/testcase/CsvFileIO.java index 8ae936c8b7a..e932c40cba6 100644 --- a/src/test/java/org/opentripplanner/transit/raptor/speed_test/model/testcase/CsvFileIO.java +++ b/src/test/java/org/opentripplanner/transit/raptor/speed_test/model/testcase/CsvFileIO.java @@ -19,7 +19,6 @@ import java.util.stream.Collectors; import org.opentripplanner.api.parameter.QualifiedModeSet; import org.opentripplanner.model.GenericLocation; -import org.opentripplanner.routing.core.TraverseMode; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.util.time.DurationUtils; @@ -87,7 +86,7 @@ public void writeResultsToFile(List testCases) { return; } - try (PrintWriter out = new PrintWriter(expectedResultsOutputFile, CHARSET_UTF_8.name())) { + try (PrintWriter out = new PrintWriter(expectedResultsOutputFile, CHARSET_UTF_8)) { out.println( "tcId,nTransfers,duration,cost,walkDistance,startTime,endTime,agencies,modes,routes,stops,details" ); @@ -260,7 +259,7 @@ private Result readExpectedResult(CsvReader csvReader) throws IOException { parseTime(csvReader.get("startTime")), parseTime(csvReader.get("endTime")), str2Col(csvReader.get("agencies")), - str2Col(csvReader.get("modes"), CsvFileIO::parseMode), + str2Col(csvReader.get("modes"), TransitMode::valueOf), str2Col(csvReader.get("routes")), str2Col(csvReader.get("stops")), csvReader.get("details") @@ -276,12 +275,4 @@ private Result readExpectedResult(CsvReader csvReader) throws IOException { private boolean isCommentOrEmpty(String line) { return line.startsWith("#") || line.matches("[\\s,;|]*"); } - - private static Enum parseMode(String mode) { - try { - return TransitMode.valueOf(mode); - } catch (IllegalArgumentException ignore) { - return TraverseMode.valueOf(mode); - } - } } diff --git a/src/test/java/org/opentripplanner/transit/raptor/speed_test/model/testcase/ItineraryResultMapper.java b/src/test/java/org/opentripplanner/transit/raptor/speed_test/model/testcase/ItineraryResultMapper.java index 2654cd5dde1..9cab9c1fde8 100644 --- a/src/test/java/org/opentripplanner/transit/raptor/speed_test/model/testcase/ItineraryResultMapper.java +++ b/src/test/java/org/opentripplanner/transit/raptor/speed_test/model/testcase/ItineraryResultMapper.java @@ -12,8 +12,8 @@ import java.util.stream.Collectors; import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.model.plan.Leg; -import org.opentripplanner.model.plan.StreetLeg; import org.opentripplanner.model.plan.TransitLeg; +import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.raptor.api.path.PathStringBuilder; @@ -111,7 +111,7 @@ private static String agencyShortName(Agency agency) { private Result map(Itinerary itinerary) { List agencies = new ArrayList<>(); List routes = new ArrayList<>(); - Set> modes = new HashSet<>(); + Set modes = new HashSet<>(); List stops = new ArrayList<>(); for (Leg it : itinerary.getLegs()) { @@ -119,8 +119,6 @@ private Result map(Itinerary itinerary) { agencies.add(agencyShortName(it.getAgency())); routes.add(it.getRoute().getName()); modes.add(trLeg.getMode()); - } else if (it instanceof StreetLeg streetLeg) { - modes.add(streetLeg.getMode()); } if (it.getTo().stop != null) { stops.add(it.getTo().stop.getId().toString()); diff --git a/src/test/java/org/opentripplanner/transit/raptor/speed_test/model/testcase/Result.java b/src/test/java/org/opentripplanner/transit/raptor/speed_test/model/testcase/Result.java index addc7d7d6a4..e3d65a5abf1 100644 --- a/src/test/java/org/opentripplanner/transit/raptor/speed_test/model/testcase/Result.java +++ b/src/test/java/org/opentripplanner/transit/raptor/speed_test/model/testcase/Result.java @@ -4,6 +4,7 @@ import java.util.Collection; import java.util.Comparator; import java.util.List; +import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.util.CompositeComparator; import org.opentripplanner.util.time.DurationUtils; import org.opentripplanner.util.time.TimeUtils; @@ -52,7 +53,7 @@ class Result { Integer startTime, Integer endTime, Collection agencies, - Collection> modes, + Collection modes, Collection routes, Collection stops, String details @@ -130,7 +131,7 @@ private static List sortedList(Collection values) { return values.stream().sorted().distinct().toList(); } - private static > List sortedModes(Collection modes) { - return modes.stream().sorted(Comparator.comparing(l -> l.name())).distinct().toList(); + private static List sortedModes(Collection modes) { + return modes.stream().sorted(Comparator.comparing(Enum::name)).distinct().toList(); } }