Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public ItineraryAssertions withFarePrice(float price, String riderCategoryId, St
.filter(fp -> fp.product().medium().isPresent())
.filter(fp -> fp.product().riderCategory().get().id().equals(riderCategoryId))
.filter(fp -> fp.product().medium().get().id().equals(mediumId))
.filter(fp -> fp.product().price() != null)
.anyMatch(fp -> fp.product().price().amount().floatValue() == price));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ void partialMatchesAndErrorDetailsAreIncluded() {

@Test
void withFarePriceHandlesPositiveAndNegativeMatches() {
List<FareProductUse> fares = List.of(fare(2.75f, "orca:regular", "orca:cash"));
List<FareProductUse> fares =
List.of(fare("orca:regular", "orca:cash"), fare(2.75f, "orca:regular", "orca:cash"));
TripPlan plan =
tripPlan(itinerary(transitLeg("E", "E Line", LegMode.BUS, Duration.ofMinutes(12), fares)));

Expand Down Expand Up @@ -236,7 +237,18 @@ private static Place place(String name) {
name, 10.0f, 10.0f, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
}

private static FareProductUse fare(float amount, String riderCategoryId, String mediumId) {
private static FareProductUse fare(String riderCategoryId, String mediumId) {
return new FareProductUse(
"fare-" + riderCategoryId + "-" + mediumId,
new FareProductUse.FareProduct(
"product-" + riderCategoryId + "-" + mediumId,
"Test fare",
null,
Optional.of(new FareProductUse.FareProduct.RiderCategory(riderCategoryId, "Rider")),
Optional.of(new FareProductUse.FareProduct.FareMedium(mediumId, "Medium"))));
}

private static FareProductUse fare(Float amount, String riderCategoryId, String mediumId) {
return new FareProductUse(
"fare-" + riderCategoryId + "-" + mediumId,
new FareProductUse.FareProduct(
Expand Down