Skip to content

Commit

Permalink
Improve logging of fare products
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Oct 9, 2023
1 parent d0318ba commit 43a5eb1
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/test/java/org/opentripplanner/smoketest/SmokeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import org.opentripplanner.client.model.VehicleRentalStation;
import org.opentripplanner.client.parameters.TripPlanParameters;
import org.opentripplanner.smoketest.util.SmokeTestRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This is both a utility class and a category to select or deselect smoke tests during test
Expand All @@ -27,6 +29,8 @@
*/
public class SmokeTest {

private static final Logger LOG = LoggerFactory.getLogger(SmokeTest.class);

public static final OtpApiClient API_CLIENT = new OtpApiClient(
ZoneId.of("America/New_York"),
"http://localhost:8080"
Expand Down Expand Up @@ -112,8 +116,16 @@ static void assertThereArePatternsWithVehiclePositions() {

static void assertThatAllTransitLegsHaveFareProducts(TripPlan plan) {
var transitLegs = plan.transitItineraries().stream().flatMap(i -> i.transitLegs().stream());
transitLegs.forEach(leg ->
assertFalse(leg.fareProducts().isEmpty(), "Leg %s should have fare products".formatted(leg))
);
transitLegs.forEach(leg -> {
assertFalse(leg.fareProducts().isEmpty(), "Leg %s should have fare products".formatted(leg));

LOG.info(
"Leg with mode {} from {} to {} has {} fare products.",
leg.mode(),
leg.from(),
leg.to(),
leg.fareProducts().size()
);
});
}
}

0 comments on commit 43a5eb1

Please sign in to comment.