Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# project-wide reformatting with prettier
9c9dd613489a348d2381acdcbeab8f86589154d7
e8e9a7716955b68b5b37997a0267148f1dcbcf9e

# graphql test and documentation reformatting with prettier
12c51f44f204db31d34a1eeb0d59204226e0fa5d
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
class DecorateWithAccessibilityScoreTest implements PlanTestConstants {

private static final int ID = 1;
private static final DecorateWithAccessibilityScore DECORATOR = new DecorateWithAccessibilityScore(
WheelchairPreferences.DEFAULT.maxSlope()
);
private static final DecorateWithAccessibilityScore DECORATOR =
new DecorateWithAccessibilityScore(WheelchairPreferences.DEFAULT.maxSlope());

static List<Arguments> accessibilityScoreTestCase() {
return List.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public class EmissionsModuleTest {
void testMultipleGtfsDataReading() {
inputData.put(GTFS, new FileDataSource(CO2_GTFS_ZIP, GTFS));
inputData.put(GTFS, new FileDataSource(CO2_GTFS, GTFS));
Iterable<ConfiguredDataSource<GtfsFeedParameters>> configuredDataSource = getGtfsConfiguredDatasource();
Iterable<ConfiguredDataSource<GtfsFeedParameters>> configuredDataSource =
getGtfsConfiguredDatasource();
EmissionsDataModel emissionsDataModel = new EmissionsDataModel();
EmissionsModule emissionsModule = new EmissionsModule(
configuredDataSource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,26 @@ class EmissionsTest {
private static DefaultEmissionsService eService;
private static DecorateWithEmission decorateWithEmission;

static final ZonedDateTime TIME = OffsetDateTime
.parse("2023-07-20T17:49:06+03:00")
.toZonedDateTime();
static final ZonedDateTime TIME = OffsetDateTime.parse(
"2023-07-20T17:49:06+03:00"
).toZonedDateTime();

private static final StreetLeg STREET_LEG = StreetLeg
.create()
private static final StreetLeg STREET_LEG = StreetLeg.create()
.withMode(TraverseMode.CAR)
.withDistanceMeters(214.4)
.withStartTime(TIME)
.withEndTime(TIME.plusHours(1))
.build();

private static final Route ROUTE_WITH_EMISSIONS = TimetableRepositoryForTest
.route(id("1"))
.build();
private static final Route ROUTE_WITH_ZERO_EMISSIONS = TimetableRepositoryForTest
.route(id("2"))
.build();
private static final Route ROUTE_WITHOUT_EMISSIONS_CONFIGURED = TimetableRepositoryForTest
.route(id("3"))
.build();
private static final Route ROUTE_WITH_EMISSIONS = TimetableRepositoryForTest.route(
id("1")
).build();
private static final Route ROUTE_WITH_ZERO_EMISSIONS = TimetableRepositoryForTest.route(
id("2")
).build();
private static final Route ROUTE_WITHOUT_EMISSIONS_CONFIGURED = TimetableRepositoryForTest.route(
id("3")
).build();

@BeforeAll
static void SetUp() {
Expand Down Expand Up @@ -129,12 +128,10 @@ private ScheduledTransitLeg createTransitLeg(Route route) {
var stopTwo = testModel.stop("1:stop1", 61, 25).build();
var stopThree = testModel.stop("1:stop1", 62, 25).build();
var stopPattern = TimetableRepositoryForTest.stopPattern(stopOne, stopTwo, stopThree);
var pattern = TimetableRepositoryForTest
.tripPattern("1", route)
var pattern = TimetableRepositoryForTest.tripPattern("1", route)
.withStopPattern(stopPattern)
.build();
var trip = Trip
.of(FeedScopedId.parse("FOO:BAR"))
var trip = Trip.of(FeedScopedId.parse("FOO:BAR"))
.withMode(TransitMode.BUS)
.withRoute(route)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class FareRuleSetTest {
@BeforeEach
void setUp() {
FeedScopedId id = new FeedScopedId("feed", "fare1");
FareAttribute fareAttribute = FareAttribute
.of(id)
FareAttribute fareAttribute = FareAttribute.of(id)
.setPrice(TWO_FIFTY)
.setPaymentMethod(1)
.setTransfers(1)
Expand Down Expand Up @@ -175,8 +174,7 @@ void testMatchesWithTransferDuration() {

@Test
void testMatchesWithJourneyDuration() {
FareAttribute journeyFare = FareAttribute
.of(new FeedScopedId("feed", "journey"))
FareAttribute journeyFare = FareAttribute.of(new FeedScopedId("feed", "journey"))
.setPrice(Money.usDollars(3.00f))
.setPaymentMethod(1)
.setJourneyDuration(7200)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,11 @@ void fromCobbTransfers() {
calculateFare(rides, DEFAULT_TEST_RIDE_PRICE.plus(DEFAULT_TEST_RIDE_PRICE).plus(usDollars(3)));

// Local to circulator to express
rides =
List.of(
getLeg(COBB_AGENCY_ID, 0),
getLeg(COBB_AGENCY_ID, "BLUE", 1),
getLeg(COBB_AGENCY_ID, "101", 1)
);
rides = List.of(
getLeg(COBB_AGENCY_ID, 0),
getLeg(COBB_AGENCY_ID, "BLUE", 1),
getLeg(COBB_AGENCY_ID, "101", 1)
);
calculateFare(rides, DEFAULT_TEST_RIDE_PRICE.plus(usDollars(1)));
}

Expand All @@ -122,45 +121,41 @@ void tooManyLegs() {
);
calculateFare(rides, DEFAULT_TEST_RIDE_PRICE.plus(DEFAULT_TEST_RIDE_PRICE));

rides =
List.of(
getLeg(MARTA_AGENCY_ID, 0),
getLeg(MARTA_AGENCY_ID, 1),
getLeg(GCT_AGENCY_ID, 2),
getLeg(GCT_AGENCY_ID, 3),
getLeg(MARTA_AGENCY_ID, 4),
getLeg(COBB_AGENCY_ID, 5)
);
rides = List.of(
getLeg(MARTA_AGENCY_ID, 0),
getLeg(MARTA_AGENCY_ID, 1),
getLeg(GCT_AGENCY_ID, 2),
getLeg(GCT_AGENCY_ID, 3),
getLeg(MARTA_AGENCY_ID, 4),
getLeg(COBB_AGENCY_ID, 5)
);
calculateFare(rides, DEFAULT_TEST_RIDE_PRICE.plus(DEFAULT_TEST_RIDE_PRICE));

rides =
List.of(
getLeg(GCT_AGENCY_ID, 0),
getLeg(MARTA_AGENCY_ID, 1),
getLeg(MARTA_AGENCY_ID, 2),
getLeg(MARTA_AGENCY_ID, 3)
);
rides = List.of(
getLeg(GCT_AGENCY_ID, 0),
getLeg(MARTA_AGENCY_ID, 1),
getLeg(MARTA_AGENCY_ID, 2),
getLeg(MARTA_AGENCY_ID, 3)
);
calculateFare(rides, DEFAULT_TEST_RIDE_PRICE);

rides =
List.of(
getLeg(GCT_AGENCY_ID, 0),
getLeg(MARTA_AGENCY_ID, 1),
getLeg(MARTA_AGENCY_ID, 2),
getLeg(MARTA_AGENCY_ID, 3),
// new transfer - only got 3 from GCT
getLeg(MARTA_AGENCY_ID, 4)
);
rides = List.of(
getLeg(GCT_AGENCY_ID, 0),
getLeg(MARTA_AGENCY_ID, 1),
getLeg(MARTA_AGENCY_ID, 2),
getLeg(MARTA_AGENCY_ID, 3),
// new transfer - only got 3 from GCT
getLeg(MARTA_AGENCY_ID, 4)
);
calculateFare(rides, DEFAULT_TEST_RIDE_PRICE.plus(DEFAULT_TEST_RIDE_PRICE));

rides =
List.of(
getLeg(MARTA_AGENCY_ID, 0),
getLeg(MARTA_AGENCY_ID, 1),
getLeg(MARTA_AGENCY_ID, 2),
getLeg(GCT_AGENCY_ID, 3),
getLeg(GCT_AGENCY_ID, 4)
);
rides = List.of(
getLeg(MARTA_AGENCY_ID, 0),
getLeg(MARTA_AGENCY_ID, 1),
getLeg(MARTA_AGENCY_ID, 2),
getLeg(GCT_AGENCY_ID, 3),
getLeg(GCT_AGENCY_ID, 4)
);
calculateFare(rides, DEFAULT_TEST_RIDE_PRICE);
}

Expand All @@ -174,14 +169,13 @@ void expiredTransfer() {
);
calculateFare(rides, DEFAULT_TEST_RIDE_PRICE.plus(DEFAULT_TEST_RIDE_PRICE));

rides =
List.of(
getLeg(MARTA_AGENCY_ID, 0),
getLeg(GCT_AGENCY_ID, 1),
getLeg(GCT_AGENCY_ID, 181),
getLeg(MARTA_AGENCY_ID, 181 + 178),
getLeg(MARTA_AGENCY_ID, 181 + 179)
);
rides = List.of(
getLeg(MARTA_AGENCY_ID, 0),
getLeg(GCT_AGENCY_ID, 1),
getLeg(GCT_AGENCY_ID, 181),
getLeg(MARTA_AGENCY_ID, 181 + 178),
getLeg(MARTA_AGENCY_ID, 181 + 179)
);
calculateFare(rides, DEFAULT_TEST_RIDE_PRICE.plus(DEFAULT_TEST_RIDE_PRICE));
}

Expand All @@ -197,12 +191,11 @@ void useStreetcar() {
);
calculateFare(rides, DEFAULT_TEST_RIDE_PRICE.plus(STREETCAR_PRICE));

rides =
List.of(
getLeg(COBB_AGENCY_ID, 0),
getLeg(MARTA_AGENCY_ID, "atlsc", 1),
getLeg(COBB_AGENCY_ID, "101", 2)
);
rides = List.of(
getLeg(COBB_AGENCY_ID, 0),
getLeg(MARTA_AGENCY_ID, "atlsc", 1),
getLeg(COBB_AGENCY_ID, "101", 2)
);
calculateFare(rides, DEFAULT_TEST_RIDE_PRICE.plus(usDollars(1)).plus(STREETCAR_PRICE));
}

Expand Down Expand Up @@ -263,8 +256,7 @@ private static Leg createLeg(String agencyId, String shortName, long startTimeMi

private static Itinerary createItinerary(String agencyId, String shortName, long startTimeMins) {
var siteRepositoryBuilder = SiteRepository.of();
Agency agency = Agency
.of(new FeedScopedId(FEED_ID, agencyId))
Agency agency = Agency.of(new FeedScopedId(FEED_ID, agencyId))
.withName(agencyId)
.withTimezone(ZoneIds.NEW_YORK.getId())
.build();
Expand All @@ -282,8 +274,7 @@ private static Itinerary createItinerary(String agencyId, String shortName, long
.build();

FeedScopedId routeFeedScopeId = new FeedScopedId(FEED_ID, "123");
Route route = Route
.of(routeFeedScopeId)
Route route = Route.of(routeFeedScopeId)
.withAgency(agency)
.withShortName(shortName)
.withLongName(new NonLocalizedString("123"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@
class DefaultFareServiceTest implements PlanTestConstants {

private static final Money TEN_DOLLARS = Money.usDollars(10);
private static final FareProduct OTHER_FEED_PRODUCT = FareProduct
.of(OTHER_FEED_ATTRIBUTE.getId(), "regular", TEN_DOLLARS)
.build();
private static final FareProduct AIRPORT_TO_CITY_CENTER_PRODUCT = FareProduct
.of(AIRPORT_TO_CITY_CENTER_SET.getFareAttribute().getId(), "regular", TEN_DOLLARS)
.build();
private static final FareProduct OTHER_FEED_PRODUCT = FareProduct.of(
OTHER_FEED_ATTRIBUTE.getId(),
"regular",
TEN_DOLLARS
).build();
private static final FareProduct AIRPORT_TO_CITY_CENTER_PRODUCT = FareProduct.of(
AIRPORT_TO_CITY_CENTER_SET.getFareAttribute().getId(),
"regular",
TEN_DOLLARS
).build();

@Test
void noRules() {
Expand Down Expand Up @@ -92,13 +96,11 @@ void applyToSeveralLegs() {
List.of(
new FareProductUse(
"ddbf1572-18bc-3724-8b64-e1c7d5c8b6c6",
FareProduct
.of(
FREE_TRANSFERS_IN_CITY_SET.getFareAttribute().getId(),
"regular",
TEN_DOLLARS.plus(TEN_DOLLARS)
)
.build()
FareProduct.of(
FREE_TRANSFERS_IN_CITY_SET.getFareAttribute().getId(),
"regular",
TEN_DOLLARS.plus(TEN_DOLLARS)
).build()
)
),
firstProducts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,63 +24,64 @@ public class FareModelForTest {
public static final FareZone AIRPORT_ZONE = FareZone.of(id("airport-zone")).build();
public static final FareZone CITY_CENTER_ZONE = FareZone.of(id("city-center")).build();

public static final FareZone OTHER_FEED_ZONE = FareZone
.of(FeedScopedId.ofNullable("F2", "other-feed-zone"))
.build();
public static final FareZone OTHER_FEED_ZONE = FareZone.of(
FeedScopedId.ofNullable("F2", "other-feed-zone")
).build();

private static final SiteRepositoryBuilder SITE_REPOSITORY_BUILDER = SiteRepository.of();

static final RegularStop AIRPORT_STOP = SITE_REPOSITORY_BUILDER
.regularStop(id("airport"))
static final RegularStop AIRPORT_STOP = SITE_REPOSITORY_BUILDER.regularStop(id("airport"))
.withCoordinate(new WgsCoordinate(1, 1))
.addFareZones(AIRPORT_ZONE)
.withName(I18NString.of("Airport"))
.build();

static final RegularStop CITY_CENTER_A_STOP = SITE_REPOSITORY_BUILDER
.regularStop(id("city-center-a"))
static final RegularStop CITY_CENTER_A_STOP = SITE_REPOSITORY_BUILDER.regularStop(
id("city-center-a")
)
.withCoordinate(new WgsCoordinate(1, 2))
.addFareZones(CITY_CENTER_ZONE)
.withName(I18NString.of("City center: stop A"))
.build();
static final RegularStop CITY_CENTER_B_STOP = SITE_REPOSITORY_BUILDER
.regularStop(id("city-center-b"))
static final RegularStop CITY_CENTER_B_STOP = SITE_REPOSITORY_BUILDER.regularStop(
id("city-center-b")
)
.withCoordinate(new WgsCoordinate(1, 3))
.addFareZones(CITY_CENTER_ZONE)
.withName(I18NString.of("City center: stop B"))
.build();
static final RegularStop CITY_CENTER_C_STOP = SITE_REPOSITORY_BUILDER
.regularStop(id("city-center-c"))
static final RegularStop CITY_CENTER_C_STOP = SITE_REPOSITORY_BUILDER.regularStop(
id("city-center-c")
)
.withCoordinate(new WgsCoordinate(1, 4))
.addFareZones(CITY_CENTER_ZONE)
.withName(I18NString.of("City center: stop C"))
.build();
static final RegularStop SUBURB_STOP = SITE_REPOSITORY_BUILDER
.regularStop(id("suburb"))
static final RegularStop SUBURB_STOP = SITE_REPOSITORY_BUILDER.regularStop(id("suburb"))
.withCoordinate(new WgsCoordinate(1, 4))
.withName(I18NString.of("Suburb"))
.build();

static final RegularStop OTHER_FEED_STOP = SITE_REPOSITORY_BUILDER
.regularStop(FeedScopedId.ofNullable("F2", "other-feed-stop"))
static final RegularStop OTHER_FEED_STOP = SITE_REPOSITORY_BUILDER.regularStop(
FeedScopedId.ofNullable("F2", "other-feed-stop")
)
.withCoordinate(new WgsCoordinate(1, 5))
.withName(I18NString.of("Other feed stop"))
.addFareZones(OTHER_FEED_ZONE)
.build();
static final FareAttribute TEN_DOLLARS = FareAttribute
.of(id("airport-to-city-center"))
static final FareAttribute TEN_DOLLARS = FareAttribute.of(id("airport-to-city-center"))
.setPrice(Money.usDollars(10))
.setTransfers(0)
.build();

static final FareAttribute FREE_TRANSFERS = FareAttribute
.of(id("free-transfers"))
static final FareAttribute FREE_TRANSFERS = FareAttribute.of(id("free-transfers"))
.setPrice(Money.usDollars(20))
.setTransfers(10)
.build();

static final FareAttribute OTHER_FEED_ATTRIBUTE = FareAttribute
.of(FeedScopedId.ofNullable("F2", "other-feed-attribute"))
static final FareAttribute OTHER_FEED_ATTRIBUTE = FareAttribute.of(
FeedScopedId.ofNullable("F2", "other-feed-attribute")
)
.setPrice(Money.usDollars(10))
.setTransfers(1)
.setAgency(OTHER_FEED_AGENCY.getId())
Expand Down Expand Up @@ -124,8 +125,7 @@ public class FareModelForTest {
);
}

static Route OTHER_FEED_ROUTE = Route
.of(new FeedScopedId("F2", "other-feed-route"))
static Route OTHER_FEED_ROUTE = Route.of(new FeedScopedId("F2", "other-feed-route"))
.withAgency(OTHER_FEED_AGENCY)
.withLongName(I18NString.of("other-feed-route"))
.withMode(TransitMode.BUS)
Expand Down
Loading
Loading