Skip to content

Commit

Permalink
Reactive accessible routing smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Nov 22, 2023
1 parent e5652eb commit fe326ff
Showing 1 changed file with 36 additions and 33 deletions.
69 changes: 36 additions & 33 deletions src/test/java/org/opentripplanner/smoketest/SeattleSmokeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.opentripplanner.client.model.Coordinate;
Expand Down Expand Up @@ -49,38 +49,41 @@ public void acrossTheCity() {
SmokeTest.assertThatAllTransitLegsHaveFareProducts(plan);
}

@Test
public void accessibleRouting() throws IOException {
var tripPlan = testAccessibleRouting(1.6f);
assertFalse(tripPlan.transitItineraries().isEmpty());
}

@Test
@Disabled
public void accessibleRoutingWithVeryHighWalkReluctance() throws IOException {
testAccessibleRouting(50);
}

private TripPlan testAccessibleRouting(float walkReluctance) throws IOException {
var req = new TripPlanParametersBuilder()
.withFrom(sodo)
.withTo(clydeHill)
.withTime(SmokeTest.weekdayAtNoon())
.withWheelchair(true)
.withModes(TRANSIT)
.withWalkReluctance(walkReluctance)
.build();

var tripPlan = SmokeTest.API_CLIENT.plan(req);

// assert that accessibility score is there
tripPlan
.itineraries()
.forEach(i -> {
assertTrue(i.accessibilityScore().isPresent());
i.legs().forEach(l -> assertTrue(l.accessibilityScore().isPresent()));
});
return tripPlan;
@Nested
class AccessibleRouting {

@Test
public void accessibleRouting() throws IOException {
var tripPlan = testAccessibleRouting(1.6f);
assertFalse(tripPlan.transitItineraries().isEmpty());
}

@Test
public void accessibleRoutingWithVeryHighWalkReluctance() throws IOException {
testAccessibleRouting(50);
}

private TripPlan testAccessibleRouting(float walkReluctance) throws IOException {
var req = new TripPlanParametersBuilder()
.withFrom(sodo)
.withTo(clydeHill)
.withTime(SmokeTest.weekdayAtNoon())
.withWheelchair(true)
.withModes(TRANSIT)
.withWalkReluctance(walkReluctance)
.build();

var tripPlan = SmokeTest.API_CLIENT.plan(req);

// assert that accessibility score is there
tripPlan
.itineraries()
.forEach(i -> {
assertTrue(i.accessibilityScore().isPresent());
i.legs().forEach(l -> assertTrue(l.accessibilityScore().isPresent()));
});
return tripPlan;
}
}

@Test
Expand Down

0 comments on commit fe326ff

Please sign in to comment.