1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

adapt tests to changes in vehicleFleetManager

This commit is contained in:
oblonski 2013-06-21 11:16:51 +02:00
parent 8b01497cfc
commit 4761b30b16
2 changed files with 7 additions and 2 deletions

View file

@ -25,6 +25,8 @@ import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Arrays;
import org.junit.Before;
import org.junit.Test;
@ -59,6 +61,8 @@ public class CalcVehicleTypeDependentServiceInsertionTest {
service = mock(Service.class);
vehicleRoute = mock(VehicleRoute.class);
when(fleetManager.getAvailableVehicles()).thenReturn(Arrays.asList(veh1,veh2));
when(veh1.getCapacity()).thenReturn(10);
when(veh2.getCapacity()).thenReturn(10);

View file

@ -20,6 +20,7 @@ import basics.io.VrpXMLReader;
import basics.route.PenaltyVehicleType;
import basics.route.Vehicle;
import basics.route.VehicleImpl;
import basics.route.VehicleType;
import basics.route.VehicleTypeImpl;
public class MultipleDepotExampleWithPenaltyVehicles {
@ -52,7 +53,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
int depotCounter = 1;
for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second)){
for(int i=0;i<nuOfVehicles;i++){
VehicleTypeImpl vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setCostPerDistance(1.0).build();
VehicleType vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setCostPerDistance(1.0).build();
String vehicleId = depotCounter + "_" + (i+1) + "_vehicle";
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance(vehicleId);
vehicleBuilder.setLocationCoord(depotCoord);
@ -64,7 +65,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
/*
* define penalty-type with the same id, but other higher fixed and variable costs
*/
VehicleTypeImpl penaltyType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setFixedCost(50).setCostPerDistance(3.0).build();
VehicleType penaltyType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setFixedCost(50).setCostPerDistance(3.0).build();
/*
* to mark the penalty-type as penalty-type, wrap it with PenaltyVehicleType(Wrapper)
* this is to tell the fleetManager that this is not a regular but a penalty vehicle