Skip to content

Commit

Permalink
Add combinations to Seattle smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Feb 16, 2024
1 parent 6e7fc12 commit 4e6da15
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions src/test/java/org/opentripplanner/smoketest/SeattleSmokeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,37 @@
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.opentripplanner.client.model.Coordinate;
import org.opentripplanner.client.model.LegMode;
import org.opentripplanner.client.model.Route;
import org.opentripplanner.client.model.TripPlan;
import org.opentripplanner.client.parameters.TripPlanParameters;
import org.opentripplanner.client.parameters.TripPlanParametersBuilder;
import org.opentripplanner.smoketest.util.RequestCombinationsBuilder;
import org.opentripplanner.smoketest.util.SmokeTestRequest;

@Tag("smoke-test")
@Tag("seattle")
public class SeattleSmokeTest {

private static final String CCSWW_ROUTE = "Volunteer Services: Northwest";
Coordinate sodo = new Coordinate(47.5811, -122.3290);
Coordinate clydeHill = new Coordinate(47.6316, -122.2173);
static final Coordinate SODO = new Coordinate(47.5811, -122.3290);
static final Coordinate CLYDE_HILL = new Coordinate(47.6316, -122.2173);

Coordinate ronaldBogPark = new Coordinate(47.75601664, -122.33141);
static final Coordinate RONALD_BOG_PARK = new Coordinate(47.75601664, -122.33141);

Coordinate esperance = new Coordinate(47.7957, -122.3470);
Coordinate shoreline = new Coordinate(47.7568, -122.3483);
static final Coordinate ESPERANCE = new Coordinate(47.7957, -122.3470);
static final Coordinate SHORELINE = new Coordinate(47.7568, -122.3483);
static final Coordinate MOUNTAINLAKE_TERRACE = new Coordinate(47.78682093, -122.315694093);
static final Coordinate OLIVE_WAY = new Coordinate(47.61309420, -122.336314916);

@Test
public void acrossTheCity() {
var modes = Set.of(TRANSIT, WALK);
var plan = SmokeTest.basicRouteTest(
new SmokeTestRequest(sodo, clydeHill, modes),
new SmokeTestRequest(SODO, CLYDE_HILL, modes),
List.of("WALK", "BUS", "WALK", "BUS", "WALK")
);

Expand All @@ -66,8 +71,8 @@ public void accessibleRoutingWithVeryHighWalkReluctance() throws IOException {

private TripPlan testAccessibleRouting(float walkReluctance) throws IOException {
var req = new TripPlanParametersBuilder()
.withFrom(sodo)
.withTo(clydeHill)
.withFrom(SODO)
.withTo(CLYDE_HILL)
.withTime(SmokeTest.weekdayAtNoon())
.withWheelchair(true)
.withModes(TRANSIT)
Expand All @@ -90,14 +95,17 @@ private TripPlan testAccessibleRouting(float walkReluctance) throws IOException
@Test
public void flexAndTransit() {
var modes = Set.of(WALK, BUS, FLEX_DIRECT, FLEX_EGRESS, FLEX_ACCESS);
SmokeTest.basicRouteTest(new SmokeTestRequest(shoreline, ronaldBogPark, modes), List.of("BUS"));
SmokeTest.basicRouteTest(
new SmokeTestRequest(SHORELINE, RONALD_BOG_PARK, modes),
List.of("BUS")
);
}

@Test
public void ccswwIntoKingCounty() {
var modes = Set.of(WALK, FLEX_DIRECT);
var plan = SmokeTest.basicRouteTest(
new SmokeTestRequest(esperance, shoreline, modes),
new SmokeTestRequest(ESPERANCE, SHORELINE, modes),
List.of("BUS")
);
var itin = plan.itineraries().getFirst();
Expand All @@ -110,7 +118,7 @@ public void ccswwIntoKingCounty() {
public void ccswwIntoSnohomishCounty() {
var modes = Set.of(WALK, FLEX_DIRECT);
var plan = SmokeTest.basicRouteTest(
new SmokeTestRequest(shoreline, esperance, modes),
new SmokeTestRequest(SHORELINE, ESPERANCE, modes),
List.of("BUS", "WALK")
);
var walkAndFlex = plan
Expand Down Expand Up @@ -139,8 +147,6 @@ public void monorailRoute() throws IOException {

@Test
public void sharedStop() throws IOException {
Coordinate OLIVE_WAY = new Coordinate(47.61309420, -122.336314916);
Coordinate MOUNTAINLAKE_TERRACE = new Coordinate(47.78682093, -122.315694093);
var tpr = TripPlanParameters
.builder()
.withFrom(OLIVE_WAY)
Expand All @@ -162,6 +168,23 @@ public void sharedStop() throws IOException {
assertEquals("1040", stop.code().get());
}

static List<TripPlanParameters> buildCombinations() {
return new RequestCombinationsBuilder()
.withLocations(SODO, ESPERANCE, CLYDE_HILL, RONALD_BOG_PARK, OLIVE_WAY, MOUNTAINLAKE_TERRACE)
.withModes(TRANSIT, WALK)
.withTime(SmokeTest.weekdayAtNoon())
.includeWheelchair()
.includeArriveBy()
.build();
}

@ParameterizedTest
@MethodSource("buildCombinations")
public void accessibleRouting(TripPlanParameters params) throws IOException {
var tripPlan = SmokeTest.API_CLIENT.plan(params);
assertFalse(tripPlan.transitItineraries().isEmpty());
}

@Test
public void vehiclePositions() {
SmokeTest.assertThereArePatternsWithVehiclePositions();
Expand Down

0 comments on commit 4e6da15

Please sign in to comment.