Skip to content

Commit

Permalink
Make test more comprehensive
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Sep 18, 2024
1 parent 4434cd2 commit 349a992
Showing 1 changed file with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,38 @@

import static org.junit.jupiter.api.Assertions.assertFalse;

import org.junit.jupiter.api.Test;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.opentripplanner._support.time.ZoneIds;
import org.opentripplanner.astar.model.GraphPath;
import org.opentripplanner.routing.services.notes.StreetNotesService;
import org.opentripplanner.street.search.state.State;
import org.opentripplanner.street.search.state.TestStateBuilder;

class GraphPathToItineraryMapperTest {

@Test
void isSearchWindowAware() {
private static Stream<Arguments> cases() {
return Stream
.of(
TestStateBuilder.ofWalking(),
TestStateBuilder.ofCycling(),
TestStateBuilder.ofDriving(),
TestStateBuilder.ofScooterRental().pickUpFreeFloatingScooter(),
TestStateBuilder.ofBikeAndRide(),
TestStateBuilder.parkAndRide()
)
.map(b -> {
var state = b.streetEdge().streetEdge().build();
return Arguments.argumentSet(state.currentMode().toString(), state);
});
}

@ParameterizedTest
@MethodSource("cases")
void isSearchWindowAware(State state) {
var mapper = new GraphPathToItineraryMapper(ZoneIds.UTC, new StreetNotesService(), 1);
var state = TestStateBuilder.ofWalking().streetEdge().streetEdge().streetEdge().build();
var itin = mapper.generateItinerary(new GraphPath<>(state));
assertFalse(itin.isSearchWindowAware());
}
Expand Down

0 comments on commit 349a992

Please sign in to comment.