Skip to content

Commit 12e27a3

Browse files
Use constants for media
1 parent 5b17bfa commit 12e27a3

2 files changed

Lines changed: 17 additions & 12 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import static com.google.common.truth.Truth.assertThat;
44
import static org.opentripplanner.ext.fares.service.gtfs.v2.custom.OregonHopFareFactory.ADULT_REGIONAL_SINGLE_RIDE;
55
import static org.opentripplanner.ext.fares.service.gtfs.v2.custom.OregonHopFareFactory.CATEGORY_ADULT;
6+
import static org.opentripplanner.ext.fares.service.gtfs.v2.custom.OregonHopFareFactory.HOP_FASTPASS;
67
import static org.opentripplanner.ext.fares.service.gtfs.v2.custom.OregonHopFareFactory.LG_CTRAN_REGIONAL;
78
import static org.opentripplanner.ext.fares.service.gtfs.v2.custom.OregonHopFareFactory.LG_TRIMET_TRIMET;
8-
import static org.opentripplanner.ext.fares.service.gtfs.v2.custom.OregonHopFareFactory.MEDIUM_HOP_FASTPASS;
99
import static org.opentripplanner.ext.fares.service.gtfs.v2.custom.OregonHopFareFactory.TRIMET_ADULT_SINGLE_RIDE;
1010
import static org.opentripplanner.transit.model._data.FeedScopedIdForTestFactory.id;
1111

@@ -46,7 +46,7 @@ class OregonHopFareFactoryTest implements FareTestConstants {
4646
FP_CTRAN_REGIONAL.price()
4747
)
4848
.withCategory(CATEGORY_ADULT)
49-
.withMedium(MEDIUM_HOP_FASTPASS)
49+
.withMedium(HOP_FASTPASS)
5050
.build();
5151

5252
@Test

application/src/ext/java/org/opentripplanner/ext/fares/service/gtfs/v2/custom/OregonHopFareFactory.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ public class OregonHopFareFactory extends DefaultFareServiceFactory {
5555
.build();
5656

5757
// fare media
58-
static final FareMedium MEDIUM_HOP_FASTPASS = new FareMedium(ctranId("2"), "HOP Fastpass");
58+
static final FareMedium HOP_FASTPASS = new FareMedium(ctranId("2"), "HOP Fastpass");
59+
static final FareMedium VIRTUAL_HOP_FASTPASS = new FareMedium(
60+
ctranId("4"),
61+
"Virtual HOP Fastpass"
62+
);
63+
static final FareMedium OPEN_PAYMENT = new FareMedium(ctranId("3"), "Open Payment");
5964

6065
public FareService makeFareService() {
6166
DefaultFareService fareService = new DefaultFareService();
@@ -491,7 +496,7 @@ private Collection<FareProduct> generateHopFareProducts(
491496
Money.max(Money.ZERO_USD, adultLarger.minus(adultSmaller))
492497
)
493498
.withCategory(CATEGORY_ADULT)
494-
.withMedium(MEDIUM_HOP_FASTPASS)
499+
.withMedium(HOP_FASTPASS)
495500
.build()
496501
);
497502
hopFareProducts.add(
@@ -501,7 +506,7 @@ private Collection<FareProduct> generateHopFareProducts(
501506
Money.max(Money.ZERO_USD, adultLarger.minus(adultSmaller))
502507
)
503508
.withCategory(CATEGORY_ADULT)
504-
.withMedium(new FareMedium(ctranId("3"), "Open Payment"))
509+
.withMedium(OPEN_PAYMENT)
505510
.build()
506511
);
507512
hopFareProducts.add(
@@ -511,7 +516,7 @@ private Collection<FareProduct> generateHopFareProducts(
511516
Money.max(Money.ZERO_USD, adultLarger.minus(adultSmaller))
512517
)
513518
.withCategory(CATEGORY_ADULT)
514-
.withMedium(new FareMedium(ctranId("4"), "Virtual HOP Fastpass"))
519+
.withMedium(VIRTUAL_HOP_FASTPASS)
515520
.build()
516521
);
517522

@@ -523,7 +528,7 @@ private Collection<FareProduct> generateHopFareProducts(
523528
Money.max(Money.ZERO_USD, (seniorLarger.minus(seniorSmaller)))
524529
)
525530
.withCategory(CATEGORY_HONOURED_CITIZEN)
526-
.withMedium(MEDIUM_HOP_FASTPASS)
531+
.withMedium(HOP_FASTPASS)
527532
.build()
528533
);
529534
hopFareProducts.add(
@@ -533,7 +538,7 @@ private Collection<FareProduct> generateHopFareProducts(
533538
Money.max(Money.ZERO_USD, seniorLarger.minus(seniorSmaller))
534539
)
535540
.withCategory(CATEGORY_HONOURED_CITIZEN)
536-
.withMedium(new FareMedium(ctranId("3"), "Open Payment"))
541+
.withMedium(OPEN_PAYMENT)
537542
.build()
538543
);
539544
hopFareProducts.add(
@@ -543,7 +548,7 @@ private Collection<FareProduct> generateHopFareProducts(
543548
Money.max(Money.ZERO_USD, seniorLarger.minus(seniorSmaller))
544549
)
545550
.withCategory(CATEGORY_HONOURED_CITIZEN)
546-
.withMedium(new FareMedium(ctranId("4"), "Virtual HOP Fastpass"))
551+
.withMedium(VIRTUAL_HOP_FASTPASS)
547552
.build()
548553
);
549554

@@ -555,7 +560,7 @@ private Collection<FareProduct> generateHopFareProducts(
555560
Money.max(Money.ZERO_USD, youthLarger.minus(youthSmaller))
556561
)
557562
.withCategory(CATEGORY_YOUTH)
558-
.withMedium(MEDIUM_HOP_FASTPASS)
563+
.withMedium(HOP_FASTPASS)
559564
.build()
560565
);
561566
hopFareProducts.add(
@@ -565,7 +570,7 @@ private Collection<FareProduct> generateHopFareProducts(
565570
Money.max(Money.ZERO_USD, youthLarger.minus(youthSmaller))
566571
)
567572
.withCategory(CATEGORY_YOUTH)
568-
.withMedium(new FareMedium(ctranId("3"), "Open Payment"))
573+
.withMedium(OPEN_PAYMENT)
569574
.build()
570575
);
571576
hopFareProducts.add(
@@ -575,7 +580,7 @@ private Collection<FareProduct> generateHopFareProducts(
575580
Money.max(Money.ZERO_USD, youthLarger.minus(youthSmaller))
576581
)
577582
.withCategory(CATEGORY_YOUTH)
578-
.withMedium(new FareMedium(ctranId("4"), "Virtual HOP Fastpass"))
583+
.withMedium(VIRTUAL_HOP_FASTPASS)
579584
.build()
580585
);
581586

0 commit comments

Comments
 (0)