-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3efe676
commit a555f3d
Showing
6 changed files
with
216 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/test/java/org/opentripplanner/apis/gtfs/mapping/CarsAllowedMapperTest.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,21 @@ | ||
package org.opentripplanner.apis.gtfs.mapping; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.util.Arrays; | ||
import org.junit.jupiter.api.Test; | ||
import org.opentripplanner.transit.model.network.CarAccess; | ||
|
||
class CarsAllowedMapperTest { | ||
|
||
@Test | ||
void mapping() { | ||
Arrays | ||
.stream(CarAccess.values()) | ||
.filter(ba -> ba != CarAccess.UNKNOWN) | ||
.forEach(d -> { | ||
var mapped = CarsAllowedMapper.map(d); | ||
assertEquals(d.toString(), mapped.toString()); | ||
}); | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
src/test/java/org/opentripplanner/gtfs/mapping/CarAccessMapperTest.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,26 @@ | ||
package org.opentripplanner.gtfs.mapping; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.onebusaway.gtfs.model.Route; | ||
import org.onebusaway.gtfs.model.Trip; | ||
import org.opentripplanner.transit.model.network.CarAccess; | ||
|
||
public class CarAccessMapperTest { | ||
|
||
private static final int CARS_ALLOWED = 1; | ||
private static final int CARS_NOT_ALLOWED = 2; | ||
|
||
@Test | ||
public void testTripProvidedValues() { | ||
Trip trip = new Trip(); | ||
assertEquals(CarAccess.UNKNOWN, CarAccessMapper.mapForTrip(trip)); | ||
|
||
trip.setCarsAllowed(CARS_ALLOWED); | ||
assertEquals(CarAccess.ALLOWED, CarAccessMapper.mapForTrip(trip)); | ||
|
||
trip.setCarsAllowed(CARS_NOT_ALLOWED); | ||
assertEquals(CarAccess.NOT_ALLOWED, CarAccessMapper.mapForTrip(trip)); | ||
} | ||
} |
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.