mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add tests to ensure that pickups/deliveries remain pickups/deliveries
This commit is contained in:
parent
f961fa8971
commit
82713d76d1
1 changed files with 44 additions and 11 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2013 Stefan Schroeder
|
||||
* Copyright (C) 2014 Stefan Schroeder
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -16,23 +16,26 @@
|
|||
******************************************************************************/
|
||||
package jsprit.core.problem.solution.route;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import jsprit.core.problem.driver.DriverImpl;
|
||||
import jsprit.core.problem.driver.DriverImpl.NoDriver;
|
||||
import jsprit.core.problem.job.Delivery;
|
||||
import jsprit.core.problem.job.Pickup;
|
||||
import jsprit.core.problem.job.Service;
|
||||
import jsprit.core.problem.solution.route.activity.DeliverService;
|
||||
import jsprit.core.problem.solution.route.activity.PickupService;
|
||||
import jsprit.core.problem.solution.route.activity.ServiceActivity;
|
||||
import jsprit.core.problem.solution.route.activity.TourActivity;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
public class TestVehicleRoute {
|
||||
|
||||
|
|
@ -290,4 +293,34 @@ public class TestVehicleRoute {
|
|||
vRoute.setVehicleAndDepartureTime(new_vehicle, 1500.0);
|
||||
assertEquals(1500.0,vRoute.getDepartureTime(),0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenAddingPickup_itShouldBeTreatedAsPickup(){
|
||||
|
||||
Pickup pickup = (Pickup) Pickup.Builder.newInstance("pick").setLocationId("pickLoc").build();
|
||||
VehicleImpl vehicle = VehicleImpl.Builder.newInstance("vehicle").setStartLocationId("startLoc").build();
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle).addService(pickup).build();
|
||||
|
||||
TourActivity act = route.getActivities().get(0);
|
||||
assertTrue(act.getName().equals("pickup"));
|
||||
System.out.println(act.getName());
|
||||
assertTrue(act instanceof PickupService);
|
||||
assertTrue(((TourActivity.JobActivity)act).getJob() instanceof Pickup);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenAddingDelivery_itShouldBeTreatedAsDelivery(){
|
||||
|
||||
Delivery delivery = (Delivery) Delivery.Builder.newInstance("delivery").setLocationId("deliveryLoc").build();
|
||||
VehicleImpl vehicle = VehicleImpl.Builder.newInstance("vehicle").setStartLocationId("startLoc").build();
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle).addService(delivery).build();
|
||||
|
||||
TourActivity act = route.getActivities().get(0);
|
||||
assertTrue(act.getName().equals("delivery"));
|
||||
System.out.println(act.getName());
|
||||
assertTrue(act instanceof DeliverService);
|
||||
assertTrue(((TourActivity.JobActivity)act).getJob() instanceof Delivery);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue