forked from opentripplanner/OpenTripPlanner
-
Notifications
You must be signed in to change notification settings - Fork 2
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 opentripplanner#5610 from entur/cleanup_filters
Cleanup filters
- Loading branch information
Showing
90 changed files
with
1,362 additions
and
880 deletions.
There are no files selected for viewing
52 changes: 0 additions & 52 deletions
52
...xt-test/java/org/opentripplanner/ext/accessibilityscore/AccessibilityScoreFilterTest.java
This file was deleted.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
...t/java/org/opentripplanner/ext/accessibilityscore/DecorateWithAccessibilityScoreTest.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,64 @@ | ||
package org.opentripplanner.ext.accessibilityscore; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary; | ||
|
||
import java.util.List; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
import org.opentripplanner.model.plan.Itinerary; | ||
import org.opentripplanner.model.plan.Place; | ||
import org.opentripplanner.model.plan.PlanTestConstants; | ||
import org.opentripplanner.routing.api.request.preference.WheelchairPreferences; | ||
|
||
public class DecorateWithAccessibilityScoreTest implements PlanTestConstants { | ||
|
||
private static final int ID = 1; | ||
|
||
static List<Arguments> accessibilityScoreTestCase() { | ||
return List.of( | ||
Arguments.of( | ||
newItinerary(A, 0) | ||
.walk(20, Place.forStop(TEST_MODEL.stop("1:stop", 1d, 1d).build())) | ||
.bus(ID, 0, 50, B) | ||
.bus(ID, 52, 100, C) | ||
.build(), | ||
0.5f | ||
), | ||
Arguments.of( | ||
newItinerary(A, 0) | ||
.walk(20, Place.forStop(TEST_MODEL.stop("1:stop", 1d, 1d).build())) | ||
.bus(ID, 0, 50, B) | ||
.bus(ID, 52, 100, C) | ||
.build(), | ||
0.5f | ||
), | ||
Arguments.of( | ||
newItinerary(A, 0) | ||
.walk(20, Place.forStop(TEST_MODEL.stop("1:stop", 1d, 1d).build())) | ||
.bus(ID, 0, 50, B) | ||
.bus(ID, 52, 100, C) | ||
.build(), | ||
0.5f | ||
) | ||
); | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("accessibilityScoreTestCase") | ||
public void accessibilityScoreTest(Itinerary itinerary, float expectedAccessibilityScore) { | ||
var filter = new DecorateWithAccessibilityScore(WheelchairPreferences.DEFAULT.maxSlope()); | ||
|
||
filter.decorate(itinerary); | ||
|
||
assertEquals(expectedAccessibilityScore, itinerary.getAccessibilityScore()); | ||
|
||
itinerary | ||
.getLegs() | ||
.forEach(l -> { | ||
assertNotNull(l.accessibilityScore()); | ||
}); | ||
} | ||
} |
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
Oops, something went wrong.