-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5856 from ibi-group/flex-duration-factors
Small clean up of flex duration factor/offset
- Loading branch information
Showing
10 changed files
with
66 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.opentripplanner.ext.flex.trip; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertInstanceOf; | ||
import static org.opentripplanner.graph_builder.issue.api.DataImportIssueStore.NOOP; | ||
|
||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
import org.opentripplanner.ext.flex.FlexStopTimesForTest; | ||
import org.opentripplanner.ext.flex.FlexTripsMapper; | ||
import org.opentripplanner.ext.flex.flexpathcalculator.DirectFlexPathCalculator; | ||
import org.opentripplanner.model.StopTime; | ||
import org.opentripplanner.model.impl.OtpTransitServiceBuilder; | ||
import org.opentripplanner.transit.model._data.TransitModelForTest; | ||
import org.opentripplanner.transit.service.StopModel; | ||
|
||
class FlexTripsMapperTest { | ||
|
||
@Test | ||
void defaultTimePenalty() { | ||
var builder = new OtpTransitServiceBuilder(StopModel.of().build(), NOOP); | ||
var stopTimes = List.of(stopTime(0), stopTime(1)); | ||
builder.getStopTimesSortedByTrip().addAll(stopTimes); | ||
var trips = FlexTripsMapper.createFlexTrips(builder, NOOP); | ||
assertEquals("[UnscheduledTrip{F:flex-1}]", trips.toString()); | ||
var unscheduled = (UnscheduledTrip) trips.getFirst(); | ||
var unchanged = unscheduled.flexPathCalculator(new DirectFlexPathCalculator()); | ||
assertInstanceOf(DirectFlexPathCalculator.class, unchanged); | ||
} | ||
|
||
private static StopTime stopTime(int seq) { | ||
var st = FlexStopTimesForTest.area("08:00", "18:00"); | ||
st.setTrip(TransitModelForTest.trip("flex-1").build()); | ||
st.setStopSequence(seq); | ||
return st; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters