Skip to content

Commit

Permalink
add range to scooter in GbfsFreeVehicleStatusMapperTest
Browse files Browse the repository at this point in the history
  • Loading branch information
JustCris654 committed Dec 17, 2024
1 parent ee50eee commit b52ebca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import static java.util.Objects.requireNonNullElse;

import graphql.schema.CoercingParseValueException;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;
import org.mobilitydata.gbfs.v2_3.free_bike_status.GBFSBike;
import org.mobilitydata.gbfs.v2_3.free_bike_status.GBFSRentalUris;
import org.opentripplanner.apis.gtfs.GraphQLScalars;
import org.opentripplanner.framework.i18n.NonLocalizedString;
import org.opentripplanner.service.vehiclerental.model.RentalVehicleFuel;
import org.opentripplanner.service.vehiclerental.model.RentalVehicleType;
Expand Down Expand Up @@ -87,6 +85,7 @@ public VehicleRentalVehicle mapFreeVehicleStatus(GBFSBike vehicle) {
// if the propulsion type has an engine current_range_meters is required
if (
vehicle.getVehicleTypeId() != null &&
vehicleTypes.get(vehicle.getVehicleTypeId()) != null &&
vehicleTypes.get(vehicle.getVehicleTypeId()).propulsionType !=
RentalVehicleType.PropulsionType.HUMAN &&
rangeMeters == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class GbfsFreeVehicleStatusMapperTest {
new FeedScopedId("1", "scooter"),
"Scooter",
RentalFormFactor.SCOOTER,
null,
RentalVehicleType.PropulsionType.COMBUSTION,
null
)
)
Expand All @@ -62,7 +62,6 @@ void withDefaultType() {
bike.setLon(1d);
bike.setVehicleTypeId("bike");
var mapped = MAPPER.mapFreeVehicleStatus(bike);

assertEquals("Default vehicle type", mapped.name.toString());
}

Expand All @@ -73,6 +72,7 @@ void withType() {
bike.setLat(1d);
bike.setLon(1d);
bike.setVehicleTypeId("scooter");
bike.setCurrentRangeMeters(2000d);
var mapped = MAPPER.mapFreeVehicleStatus(bike);

assertEquals("Scooter", mapped.name.toString());
Expand Down

0 comments on commit b52ebca

Please sign in to comment.