Skip to content

Commit 49bbdaf

Browse files
Add test for priorities
1 parent 991d128 commit 49bbdaf

14 files changed

+132
-103
lines changed

application/src/ext-test/java/org/opentripplanner/ext/fares/service/gtfs/v2/AreasTest.java

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id;
77

88
import com.google.common.collect.Multimaps;
9-
import java.util.List;
109
import java.util.Map;
1110
import java.util.Set;
1211
import org.junit.jupiter.api.Test;
@@ -54,21 +53,19 @@ class AreasTest implements PlanTestConstants {
5453

5554
private static final GtfsFaresV2Service SERVICE = GtfsFaresV2Service.of()
5655
.withLegRules(
57-
List.of(
58-
FareLegRule.of(id("2"), SINGLE_TO_OUTER)
59-
.withLegGroupId(LEG_GROUP1)
60-
.withToAreaId(OUTER_ZONE)
61-
.build(),
62-
FareLegRule.of(id("3"), SINGLE_FROM_OUTER)
63-
.withLegGroupId(LEG_GROUP1)
64-
.withFromAreaId(OUTER_ZONE)
65-
.build(),
66-
FareLegRule.of(id("6"), INNER_TO_OUTER_ZONE_SINGLE)
67-
.withLegGroupId(LEG_GROUP1)
68-
.withFromAreaId(INNER_ZONE)
69-
.withToAreaId(OUTER_ZONE)
70-
.build()
71-
)
56+
FareLegRule.of(id("2"), SINGLE_TO_OUTER)
57+
.withLegGroupId(LEG_GROUP1)
58+
.withToAreaId(OUTER_ZONE)
59+
.build(),
60+
FareLegRule.of(id("3"), SINGLE_FROM_OUTER)
61+
.withLegGroupId(LEG_GROUP1)
62+
.withFromAreaId(OUTER_ZONE)
63+
.build(),
64+
FareLegRule.of(id("6"), INNER_TO_OUTER_ZONE_SINGLE)
65+
.withLegGroupId(LEG_GROUP1)
66+
.withFromAreaId(INNER_ZONE)
67+
.withToAreaId(OUTER_ZONE)
68+
.build()
7269
)
7370
.withStopAreas(
7471
Multimaps.forMap(

application/src/ext-test/java/org/opentripplanner/ext/fares/service/gtfs/v2/CostedTransferAcrossNetworksTest.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@ class CostedTransferAcrossNetworksTest implements PlanTestConstants, FareTestCon
2525

2626
private final GtfsFaresV2Service service = GtfsFaresV2Service.of()
2727
.withLegRules(
28-
List.of(
29-
FareLegRule.of(LEG_GROUP_A, FARE_PRODUCT_A)
30-
.withLegGroupId(LEG_GROUP_A)
31-
.withNetworkId(NETWORK_A.getId())
32-
.build(),
33-
FareLegRule.of(LEG_GROUP_B, FARE_PRODUCT_B)
34-
.withLegGroupId(LEG_GROUP_B)
35-
.withNetworkId(NETWORK_B.getId())
36-
.build()
37-
)
28+
FareLegRule.of(LEG_GROUP_A, FARE_PRODUCT_A)
29+
.withLegGroupId(LEG_GROUP_A)
30+
.withNetworkId(NETWORK_A.getId())
31+
.build(),
32+
FareLegRule.of(LEG_GROUP_B, FARE_PRODUCT_B)
33+
.withLegGroupId(LEG_GROUP_B)
34+
.withNetworkId(NETWORK_B.getId())
35+
.build()
3836
)
3937
.withTransferRules(
4038
List.of(

application/src/ext-test/java/org/opentripplanner/ext/fares/service/gtfs/v2/CostedTransferInNetworkTest.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,14 @@ class CostedTransferInNetworkTest implements PlanTestConstants, FareTestConstant
2727

2828
private static final GtfsFaresV2Service SERVICE = GtfsFaresV2Service.of()
2929
.withLegRules(
30-
List.of(
31-
FareLegRule.of(id("r1"), FARE_PRODUCT_A)
32-
.withLegGroupId(LEG_GROUP)
33-
.withNetworkId(NETWORK_A.getId())
34-
.build(),
35-
FareLegRule.of(id("r2"), FARE_PRODUCT_B)
36-
.withLegGroupId(LEG_GROUP)
37-
.withNetworkId(NETWORK_A.getId())
38-
.build()
39-
)
30+
FareLegRule.of(id("r1"), FARE_PRODUCT_A)
31+
.withLegGroupId(LEG_GROUP)
32+
.withNetworkId(NETWORK_A.getId())
33+
.build(),
34+
FareLegRule.of(id("r2"), FARE_PRODUCT_B)
35+
.withLegGroupId(LEG_GROUP)
36+
.withNetworkId(NETWORK_A.getId())
37+
.build()
4038
)
4139
.withTransferRules(
4240
List.of(

application/src/ext-test/java/org/opentripplanner/ext/fares/service/gtfs/v2/DepartureToArrivalTimeLimitTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ class DepartureToArrivalTimeLimitTest implements PlanTestConstants, FareTestCons
2121
private static final FeedScopedId LEG_GROUP = id("leg-group-a");
2222

2323
private static final GtfsFaresV2Service SERVICE = GtfsFaresV2Service.of()
24-
.withLegRules(
25-
List.of(FareLegRule.of(id("r1"), FARE_PRODUCT_A).withLegGroupId(LEG_GROUP).build())
26-
)
24+
.withLegRules(FareLegRule.of(id("r1"), FARE_PRODUCT_A).withLegGroupId(LEG_GROUP).build())
2725
.withTransferRules(
2826
List.of(
2927
FareTransferRule.of()

application/src/ext-test/java/org/opentripplanner/ext/fares/service/gtfs/v2/DepartureToDepartureTimeLimitTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ class DepartureToDepartureTimeLimitTest implements PlanTestConstants, FareTestCo
2121
private static final FeedScopedId LEG_GROUP = id("leg-group-a");
2222

2323
private static final GtfsFaresV2Service SERVICE = GtfsFaresV2Service.of()
24-
.withLegRules(
25-
List.of(FareLegRule.of(id("r1"), FARE_PRODUCT_A).withLegGroupId(LEG_GROUP).build())
26-
)
24+
.withLegRules(FareLegRule.of(id("r1"), FARE_PRODUCT_A).withLegGroupId(LEG_GROUP).build())
2725
.withTransferRules(
2826
List.of(
2927
FareTransferRule.of()

application/src/ext-test/java/org/opentripplanner/ext/fares/service/gtfs/v2/FlexLegTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@ class FlexLegTest implements PlanTestConstants, FareTestConstants {
2020

2121
private static final GtfsFaresV2Service SERVICE = GtfsFaresV2Service.of()
2222
.withLegRules(
23-
List.of(
24-
FareLegRule.of(id("r1"), FARE_PRODUCT_A)
25-
.withLegGroupId(LEG_GROUP)
26-
.withFromAreaId(STOP_AREA)
27-
.withToAreaId(STOP_AREA)
28-
.build()
29-
)
23+
FareLegRule.of(id("r1"), FARE_PRODUCT_A)
24+
.withLegGroupId(LEG_GROUP)
25+
.withFromAreaId(STOP_AREA)
26+
.withToAreaId(STOP_AREA)
27+
.build()
3028
)
3129
.withTransferRules(List.of())
3230
.withStopAreas(ImmutableMultimap.of(A.stop.getId(), STOP_AREA))

application/src/ext-test/java/org/opentripplanner/ext/fares/service/gtfs/v2/FreeTransferAcrossNetworksTest.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@ class FreeTransferAcrossNetworksTest implements PlanTestConstants, FareTestConst
2525

2626
GtfsFaresV2Service service = GtfsFaresV2Service.of()
2727
.withLegRules(
28-
List.of(
29-
FareLegRule.of(LEG_GROUP_A, FARE_PRODUCT_A)
30-
.withLegGroupId(LEG_GROUP_A)
31-
.withNetworkId(NETWORK_A.getId())
32-
.build(),
33-
FareLegRule.of(LEG_GROUP_B, FARE_PRODUCT_B)
34-
.withLegGroupId(LEG_GROUP_B)
35-
.withNetworkId(NETWORK_B.getId())
36-
.build()
37-
)
28+
FareLegRule.of(LEG_GROUP_A, FARE_PRODUCT_A)
29+
.withLegGroupId(LEG_GROUP_A)
30+
.withNetworkId(NETWORK_A.getId())
31+
.build(),
32+
FareLegRule.of(LEG_GROUP_B, FARE_PRODUCT_B)
33+
.withLegGroupId(LEG_GROUP_B)
34+
.withNetworkId(NETWORK_B.getId())
35+
.build()
3836
)
3937
.withTransferRules(
4038
List.of(

application/src/ext-test/java/org/opentripplanner/ext/fares/service/gtfs/v2/FreeTransferInNetworkTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,10 @@ class FreeTransferInNetworkTest implements PlanTestConstants {
3535

3636
GtfsFaresV2Service service = GtfsFaresV2Service.of()
3737
.withLegRules(
38-
List.of(
39-
FareLegRule.of(id("6"), REGULAR)
40-
.withLegGroupId(LEG_GROUP)
41-
.withNetworkId(NETWORK.getId())
42-
.build()
43-
)
38+
FareLegRule.of(id("6"), REGULAR)
39+
.withLegGroupId(LEG_GROUP)
40+
.withNetworkId(NETWORK.getId())
41+
.build()
4442
)
4543
.withTransferRules(
4644
List.of(

application/src/ext-test/java/org/opentripplanner/ext/fares/service/gtfs/v2/FreeTransferTimeLimitTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ class FreeTransferTimeLimitTest implements PlanTestConstants, FareTestConstants
2727

2828
private static final GtfsFaresV2Service SERVICE = GtfsFaresV2Service.of()
2929
.withLegRules(
30-
List.of(
31-
FareLegRule.of(id("r1"), FARE_PRODUCT_A)
32-
.withLegGroupId(LEG_GROUP)
33-
.withNetworkId(NETWORK_A.getId())
34-
.build()
35-
)
30+
FareLegRule.of(id("r1"), FARE_PRODUCT_A)
31+
.withLegGroupId(LEG_GROUP)
32+
.withNetworkId(NETWORK_A.getId())
33+
.build()
3634
)
3735
.withTransferRules(
3836
List.of(

application/src/ext-test/java/org/opentripplanner/ext/fares/service/gtfs/v2/GtfsFaresV2ServiceTest.java

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id;
88

99
import java.time.Duration;
10-
import java.util.List;
1110
import java.util.Set;
1211
import org.junit.jupiter.api.Test;
1312
import org.opentripplanner.core.model.id.FeedScopedId;
@@ -61,21 +60,19 @@ class GtfsFaresV2ServiceTest implements PlanTestConstants {
6160

6261
private static final GtfsFaresV2Service SERVICE = GtfsFaresV2Service.of()
6362
.withLegRules(
64-
List.of(
65-
FareLegRule.of(id("1"), ALL_NETWORKS_SINGLE).withLegGroupId(LEG_GROUP1).build(),
66-
FareLegRule.of(id("4"), ALL_NETWORKS_DAY_PASS).withLegGroupId(LEG_GROUP1).build(),
67-
FareLegRule.of(id("5"), EXPRESS_DAY_PASS)
68-
.withLegGroupId(LEG_GROUP1)
69-
.withNetworkId(expressNetwork)
70-
.build(),
71-
FareLegRule.of(id("5"), LOCAL_DAY_PASS)
72-
.withLegGroupId(LEG_GROUP1)
73-
.withNetworkId(localNetwork)
74-
.build(),
75-
FareLegRule.of(MONTHLY_PASS.id(), MONTHLY_PASS)
76-
.withLegGroupId(id("another-leg-group"))
77-
.build()
78-
)
63+
FareLegRule.of(id("1"), ALL_NETWORKS_SINGLE).withLegGroupId(LEG_GROUP1).build(),
64+
FareLegRule.of(id("4"), ALL_NETWORKS_DAY_PASS).withLegGroupId(LEG_GROUP1).build(),
65+
FareLegRule.of(id("5"), EXPRESS_DAY_PASS)
66+
.withLegGroupId(LEG_GROUP1)
67+
.withNetworkId(expressNetwork)
68+
.build(),
69+
FareLegRule.of(id("5"), LOCAL_DAY_PASS)
70+
.withLegGroupId(LEG_GROUP1)
71+
.withNetworkId(localNetwork)
72+
.build(),
73+
FareLegRule.of(MONTHLY_PASS.id(), MONTHLY_PASS)
74+
.withLegGroupId(id("another-leg-group"))
75+
.build()
7976
)
8077
.build();
8178

0 commit comments

Comments
 (0)