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

remove deprecated code for next development iteration, i.e. release

1.3.0
This commit is contained in:
oblonski 2014-05-16 06:27:49 +02:00
parent 3afae5de91
commit 3771c8494d
56 changed files with 173 additions and 1602 deletions

View file

@ -27,7 +27,6 @@ import jsprit.core.algorithm.SearchStrategyModule;
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
import jsprit.core.algorithm.acceptor.GreedyAcceptance;
import jsprit.core.algorithm.acceptor.SolutionAcceptor;
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms.ModKey;
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms.TypedMap.AcceptorKey;
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms.TypedMap.RuinStrategyKey;
@ -45,14 +44,13 @@ import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import jsprit.core.problem.solution.route.VehicleRoute;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
import org.junit.Before;
import org.junit.Test;
public class TestAlgorithmReader {
XMLConfiguration config;
AlgorithmConfig config;
VehicleRoutingProblem vrp;
@ -60,7 +58,8 @@ public class TestAlgorithmReader {
@Before
public void doBefore() throws ConfigurationException{
config = new XMLConfiguration("src/test/resources/testConfig.xml");
config = new AlgorithmConfig();
new AlgorithmConfigXmlReader(config).setSchemaValidation(false).read("src/test/resources/testConfig.xml");
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
solutions = new ArrayList<VehicleRoutingProblemSolution>();
new VrpXMLReader(vrpBuilder,solutions).read("src/test/resources/finiteVrp.xml");
@ -216,33 +215,27 @@ public class TestAlgorithmReader {
}
@SuppressWarnings("deprecation")
@Test
public void initialiseConstructionAlgoCorrectly(){
VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
assertTrue(true);
}
@Test
public void whenCreatingAlgorithm_nOfStrategiesIsCorrect(){
@SuppressWarnings("deprecation")
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
assertEquals(3, algo.getSearchStrategyManager().getStrategies().size());
}
@Test
public void whenCreatingAlgorithm_nOfIterationsIsReadCorrectly(){
@SuppressWarnings("deprecation")
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
assertEquals(10, algo.getNuOfIterations());
}
@Test
public void whenCreatingAlgorithm_nOfStrategyModulesIsCorrect(){
@SuppressWarnings("deprecation")
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
int nOfModules = 0;
for(SearchStrategy strat : algo.getSearchStrategyManager().getStrategies()){
nOfModules += strat.getSearchStrategyModules().size();

View file

@ -14,28 +14,6 @@ import org.junit.Test;
public class StateManagerTest {
@SuppressWarnings("deprecation")
@Test
public void whenInternalRouteStateIsSet_itMustBeSetCorrectly(){
VehicleRoute route = mock(VehicleRoute.class);
StateManager stateManager = new StateManager(mock(VehicleRoutingTransportCosts.class));
StateId id = StateFactory.createId("myState");
State state = StateFactory.createState(1.);
stateManager.putInternalRouteState(route, id, state);
assertEquals(1.,stateManager.getRouteState(route, id).toDouble(),0.01);
}
@SuppressWarnings("deprecation")
@Test
public void whenRouteStateIsSet_itMustBeSetCorrectly(){
VehicleRoute route = mock(VehicleRoute.class);
StateManager stateManager = new StateManager(mock(VehicleRoutingTransportCosts.class));
StateId id = StateFactory.createId("myState");
State state = StateFactory.createState(1.);
stateManager.putRouteState(route, id, state);
assertEquals(1.,stateManager.getRouteState(route, id).toDouble(),0.01);
}
@Test
public void whenRouteStateIsSetWithGenericMethod_itMustBeSetCorrectly(){
VehicleRoute route = mock(VehicleRoute.class);
@ -78,30 +56,6 @@ public class StateManagerTest {
assertEquals(500, getCap.get(0));
}
@SuppressWarnings("deprecation")
@Test
public void whenInternalActivityStateIsSet_itMustBeSetCorrectly(){
TourActivity activity = mock(TourActivity.class);
StateManager stateManager = new StateManager(mock(VehicleRoutingTransportCosts.class));
StateId id = StateFactory.createId("myState");
State state = StateFactory.createState(1.);
stateManager.putInternalActivityState(activity, id, state);
assertEquals(1.,stateManager.getActivityState(activity, id).toDouble(),0.01);
}
@SuppressWarnings("deprecation")
@Test
public void whenActivityStateIsSet_itMustBeSetCorrectly(){
TourActivity activity = mock(TourActivity.class);
StateManager stateManager = new StateManager(mock(VehicleRoutingTransportCosts.class));
StateId id = StateFactory.createId("myState");
State state = StateFactory.createState(1.);
stateManager.putActivityState(activity, id, state);
assertEquals(1.,stateManager.getActivityState(activity, id).toDouble(),0.01);
}
@Test
public void whenActivityStateIsSetWithGenericMethod_itMustBeSetCorrectly(){
TourActivity activity = mock(TourActivity.class);

View file

@ -63,14 +63,12 @@ public class VrpXMLReaderTest {
assertTrue(idsInCollection(Arrays.asList("v1","v2"),vrp.getVehicles()));
}
@SuppressWarnings("deprecation")
@Test
public void whenReadingVrp_vehiclesAreReadCorrectly2(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName);
VehicleRoutingProblem vrp = builder.build();
Vehicle v1 = getVehicle("v1",vrp.getVehicles());
assertEquals(20,v1.getCapacity());
assertEquals(20,v1.getType().getCapacityDimensions().get(0));
assertEquals(100.0,v1.getStartLocationCoordinate().getX(),0.01);
assertEquals(0.0,v1.getEarliestDeparture(),0.01);
@ -141,14 +139,12 @@ public class VrpXMLReaderTest {
assertEquals(2,shipCounter);
}
@SuppressWarnings("deprecation")
@Test
public void whenReadingServices_capOfService1IsReadCorrectly(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName);
VehicleRoutingProblem vrp = builder.build();
Service s1 = (Service) vrp.getJobs().get("1");
assertEquals(1,s1.getCapacityDemand());
assertEquals(1,s1.getSize().get(0));
}
@ -303,14 +299,12 @@ public class VrpXMLReaderTest {
assertEquals("startLoc",v.getStartLocationId());
}
@SuppressWarnings("deprecation")
@Test
public void whenReadingJobs_capOfShipment3IsReadCorrectly(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName);
VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3");
assertEquals(10,s.getCapacityDemand());
assertEquals(10,s.getSize().get(0));
}

View file

@ -35,7 +35,6 @@ import jsprit.core.util.Coordinate;
import org.junit.Before;
import org.junit.Test;
@SuppressWarnings("deprecation")
public class VrpXMLWriterTest {
private String infileName;
@ -50,7 +49,7 @@ public class VrpXMLWriterTest {
public void whenWritingInfiniteVrp_itWritesCorrectly(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
builder.setFleetSize(FleetSize.INFINITE);
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
Vehicle vehicle = VehicleImpl.Builder.newInstance("myVehicle").setStartLocationId("loc").setType(type).build();
builder.addVehicle(vehicle);
VehicleRoutingProblem vrp = builder.build();
@ -61,8 +60,8 @@ public class VrpXMLWriterTest {
public void whenWritingFiniteVrp_itWritesCorrectly(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
builder.setFleetSize(FleetSize.FINITE);
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
@ -75,8 +74,8 @@ public class VrpXMLWriterTest {
public void t(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
builder.setFleetSize(FleetSize.FINITE);
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
@ -92,8 +91,8 @@ public class VrpXMLWriterTest {
public void whenWritingServices_itWritesThemCorrectly(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
@ -101,8 +100,8 @@ public class VrpXMLWriterTest {
builder.addVehicle(v2);
Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@ -127,7 +126,7 @@ public class VrpXMLWriterTest {
.addSizeDimension(0, 20)
.addSizeDimension(1, 200)
.setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@ -149,17 +148,17 @@ public class VrpXMLWriterTest {
public void whenWritingShipments_readingThemAgainMustReturnTheWrittenLocationIdsOfS1(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
Shipment s1 = Shipment.Builder.newInstance("1", 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).build();
Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
@ -180,17 +179,17 @@ public class VrpXMLWriterTest {
public void whenWritingShipments_readingThemAgainMustReturnTheWrittenPickupTimeWindowsOfS1(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
Shipment s1 = Shipment.Builder.newInstance("1", 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).build();
Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
@ -212,17 +211,17 @@ public class VrpXMLWriterTest {
public void whenWritingShipments_readingThemAgainMustReturnTheWrittenDeliveryTimeWindowsOfS1(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
Shipment s1 = Shipment.Builder.newInstance("1", 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).build();
Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
@ -243,17 +242,17 @@ public class VrpXMLWriterTest {
public void whenWritingShipments_readingThemAgainMustReturnTheWrittenDeliveryServiceTimeOfS1(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
Shipment s1 = Shipment.Builder.newInstance("1", 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
@ -274,17 +273,17 @@ public class VrpXMLWriterTest {
public void whenWritingShipments_readingThemAgainMustReturnTheWrittenLocationIdOfS1(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
Shipment s1 = Shipment.Builder.newInstance("1", 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
@ -303,17 +302,17 @@ public class VrpXMLWriterTest {
public void whenWritingShipments_readingThemAgainMustReturnTheWrittenLocationCoordOfS1(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
Shipment s1 = Shipment.Builder.newInstance("1", 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
@ -343,7 +342,7 @@ public class VrpXMLWriterTest {
.addSizeDimension(2, 100)
.build();
Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
@ -366,16 +365,16 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleV1_itsStartLocationMustBeWrittenCorrectly(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@ -394,16 +393,16 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleV1_itDoesNotReturnToDepotMustBeWrittenCorrectly(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@ -420,16 +419,16 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleV1_readingAgainAssignsCorrectType(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@ -446,16 +445,16 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleV2_readingAgainAssignsCorrectType(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@ -466,7 +465,7 @@ public class VrpXMLWriterTest {
Vehicle v = getVehicle("v2",readVrp.getVehicles());
assertEquals("vehType2",v.getType().getTypeId());
assertEquals(200,v.getType().getCapacity());
assertEquals(200,v.getType().getCapacityDimensions().get(0));
}
@ -474,8 +473,8 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleV2_readingItsLocationsAgainReturnsCorrectLocations(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("startLoc").setStartLocationCoordinate(Coordinate.newInstance(1, 2))
.setEndLocationId("endLoc").setEndLocationCoordinate(Coordinate.newInstance(4, 5)).setType(type2).build();
@ -483,8 +482,8 @@ public class VrpXMLWriterTest {
builder.addVehicle(v1);
builder.addVehicle(v2);
Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@ -502,8 +501,8 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleV2_readingItsLocationsCoordsAgainReturnsCorrectLocationsCoords(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("startLoc").setStartLocationCoordinate(Coordinate.newInstance(1, 2))
.setEndLocationId("endLoc").setEndLocationCoordinate(Coordinate.newInstance(4, 5)).setType(type2).build();
@ -511,8 +510,8 @@ public class VrpXMLWriterTest {
builder.addVehicle(v1);
builder.addVehicle(v2);
Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@ -533,7 +532,7 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleWithSeveralCapacityDimensions_itShouldBeWrittenAndRereadCorrectly(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("type", 200)
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("type")
.addCapacityDimension(0, 100)
.addCapacityDimension(1, 1000)
.addCapacityDimension(2, 10000)
@ -561,7 +560,7 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleWithSeveralCapacityDimensions_itShouldBeWrittenAndRereadCorrectlyV2(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("type", 200)
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("type")
.addCapacityDimension(0, 100)
.addCapacityDimension(1, 1000)
.addCapacityDimension(10, 10000)

View file

@ -6,10 +6,9 @@ import org.junit.Test;
public class DeliveryTest {
@SuppressWarnings("deprecation")
@Test(expected=IllegalStateException.class)
public void whenNeitherLocationIdNorCoordIsSet_itThrowsException(){
Delivery.Builder.newInstance("p", 0).build();
Delivery.Builder.newInstance("p").build();
}
@Test
@ -32,12 +31,10 @@ public class DeliveryTest {
assertEquals(0,one.getSize().get(0));
}
@SuppressWarnings("deprecation")
@Test
public void whenPickupIsBuiltWithConstructorWhereSizeIsSpecified_capacityShouldBeSetCorrectly(){
Delivery one = (Delivery)Delivery.Builder.newInstance("s",1).setLocationId("foofoo")
Delivery one = (Delivery)Delivery.Builder.newInstance("s").addSizeDimension(0, 1).setLocationId("foofoo")
.build();
assertEquals(1,one.getCapacityDemand());
assertEquals(1,one.getSize().getNuOfDimensions());
assertEquals(1,one.getSize().get(0));
}

View file

@ -6,10 +6,9 @@ import org.junit.Test;
public class PickupTest {
@SuppressWarnings("deprecation")
@Test(expected=IllegalStateException.class)
public void whenNeitherLocationIdNorCoordIsSet_itThrowsException(){
Pickup.Builder.newInstance("p", 0).build();
Pickup.Builder.newInstance("p").build();
}
@Test
@ -32,12 +31,10 @@ public class PickupTest {
assertEquals(0,one.getSize().get(0));
}
@SuppressWarnings("deprecation")
@Test
public void whenPickupIsBuiltWithConstructorWhereSizeIsSpecified_capacityShouldBeSetCorrectly(){
Pickup one = (Pickup)Pickup.Builder.newInstance("s",1).setLocationId("foofoo")
Pickup one = (Pickup)Pickup.Builder.newInstance("s").addSizeDimension(0, 1).setLocationId("foofoo")
.build();
assertEquals(1,one.getCapacityDemand());
assertEquals(1,one.getSize().getNuOfDimensions());
assertEquals(1,one.getSize().get(0));
}

View file

@ -30,21 +30,20 @@ import jsprit.core.util.Coordinate;
import org.junit.Test;
@SuppressWarnings("deprecation")
public class ServiceTest {
@Test
public void whenTwoServicesHaveTheSameId_theirReferencesShouldBeUnEqual(){
Service one = Service.Builder.newInstance("service", 10).setLocationId("foo").build();
Service two = Service.Builder.newInstance("service", 10).setLocationId("fo").build();
Service one = Service.Builder.newInstance("service").addSizeDimension(0, 10).setLocationId("foo").build();
Service two = Service.Builder.newInstance("service").addSizeDimension(0, 10).setLocationId("fo").build();
assertTrue(one != two);
}
@Test
public void whenTwoServicesHaveTheSameId_theyShouldBeEqual(){
Service one = Service.Builder.newInstance("service", 10).setLocationId("foo").build();
Service two = Service.Builder.newInstance("service", 10).setLocationId("fo").build();
Service one = Service.Builder.newInstance("service").addSizeDimension(0, 10).setLocationId("foo").build();
Service two = Service.Builder.newInstance("service").addSizeDimension(0, 10).setLocationId("fo").build();
assertTrue(one.equals(two));
}
@ -52,8 +51,8 @@ public class ServiceTest {
@Test
public void noName(){
Set<Service> serviceSet = new HashSet<Service>();
Service one = Service.Builder.newInstance("service", 10).setLocationId("foo").build();
Service two = Service.Builder.newInstance("service", 10).setLocationId("fo").build();
Service one = Service.Builder.newInstance("service").addSizeDimension(0, 10).setLocationId("foo").build();
Service two = Service.Builder.newInstance("service").addSizeDimension(0, 10).setLocationId("fo").build();
serviceSet.add(one);
// assertTrue(serviceSet.contains(two));
serviceSet.remove(two);
@ -85,35 +84,34 @@ public class ServiceTest {
@Test
public void whenShipmentIsBuiltWithConstructorWhereSizeIsSpecified_capacityShouldBeSetCorrectly(){
Service one = Service.Builder.newInstance("s",1).setLocationId("foofoo")
Service one = Service.Builder.newInstance("s").addSizeDimension(0, 1).setLocationId("foofoo")
.build();
assertEquals(1,one.getCapacityDemand());
assertEquals(1,one.getSize().getNuOfDimensions());
assertEquals(1,one.getSize().get(0));
}
@Test
public void whenCallingForNewInstanceOfBuilder_itShouldReturnBuilderCorrectly(){
Service.Builder builder = Service.Builder.newInstance("s", 0);
Service.Builder builder = Service.Builder.newInstance("s");
assertNotNull(builder);
assertTrue(builder instanceof Service.Builder);
}
@Test
public void whenSettingNoType_itShouldReturn_service(){
Service s = Service.Builder.newInstance("s", 0).setLocationId("loc").build();
Service s = Service.Builder.newInstance("s").setLocationId("loc").build();
assertEquals("service",s.getType());
}
@Test
public void whenSettingLocation_itShouldBeSetCorrectly(){
Service s = Service.Builder.newInstance("s", 0).setLocationId("loc").build();
Service s = Service.Builder.newInstance("s").setLocationId("loc").build();
assertEquals("loc",s.getLocationId());
}
@Test
public void whenSettingLocationCoord_itShouldBeSetCorrectly(){
Service s = Service.Builder.newInstance("s", 0).setCoord(Coordinate.newInstance(1, 2)).build();
Service s = Service.Builder.newInstance("s").setCoord(Coordinate.newInstance(1, 2)).build();
assertEquals(1.0,s.getCoord().getX(),0.01);
assertEquals(2.0,s.getCoord().getY(),0.01);
}
@ -121,30 +119,30 @@ public class ServiceTest {
@Test(expected=IllegalStateException.class)
public void whenSettingNeitherLocationIdNorCoord_throwsException(){
@SuppressWarnings("unused")
Service s = Service.Builder.newInstance("s", 0).build();
Service s = Service.Builder.newInstance("s").build();
}
@Test(expected=IllegalArgumentException.class)
public void whenServiceTimeSmallerZero_throwIllegalStateException(){
@SuppressWarnings("unused")
Service s = Service.Builder.newInstance("s", 0).setLocationId("loc").setServiceTime(-1).build();
Service s = Service.Builder.newInstance("s").setLocationId("loc").setServiceTime(-1).build();
}
@Test
public void whenSettingServiceTime_itShouldBeSetCorrectly(){
Service s = Service.Builder.newInstance("s", 0).setLocationId("loc").setServiceTime(1).build();
Service s = Service.Builder.newInstance("s").setLocationId("loc").setServiceTime(1).build();
assertEquals(1.0,s.getServiceDuration(),0.01);
}
@Test(expected=IllegalArgumentException.class)
public void whenTimeWindowIsNull_throwException(){
@SuppressWarnings("unused")
Service s = Service.Builder.newInstance("s", 0).setLocationId("loc").setTimeWindow(null).build();
Service s = Service.Builder.newInstance("s").setLocationId("loc").setTimeWindow(null).build();
}
@Test
public void whenSettingTimeWindow_itShouldBeSetCorrectly(){
Service s = Service.Builder.newInstance("s", 0).setLocationId("loc").setTimeWindow(TimeWindow.newInstance(1.0, 2.0)).build();
Service s = Service.Builder.newInstance("s").setLocationId("loc").setTimeWindow(TimeWindow.newInstance(1.0, 2.0)).build();
assertEquals(1.0,s.getTimeWindow().getStart(),0.01);
assertEquals(2.0,s.getTimeWindow().getEnd(),0.01);
}

View file

@ -8,14 +8,13 @@ import jsprit.core.util.Coordinate;
import org.junit.Test;
@SuppressWarnings("deprecation")
public class ShipmentTest {
@Test
public void whenTwoShipmentsHaveTheSameId_theyReferencesShouldBeUnEqual(){
Shipment one = Shipment.Builder.newInstance("s", 10).setPickupLocation("foo").
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
Shipment two = Shipment.Builder.newInstance("s", 10).setPickupLocation("foo").
Shipment two = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
assertTrue(one != two);
@ -23,9 +22,9 @@ public class ShipmentTest {
@Test
public void whenTwoShipmentsHaveTheSameId_theyShouldBeEqual(){
Shipment one = Shipment.Builder.newInstance("s", 10).setPickupLocation("foo").
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
Shipment two = Shipment.Builder.newInstance("s", 10).setPickupLocation("foo").
Shipment two = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
assertTrue(one.equals(two));
@ -33,15 +32,15 @@ public class ShipmentTest {
@Test
public void whenShipmentIsInstantiatedWithASizeOf10_theSizeShouldBe10(){
Shipment one = Shipment.Builder.newInstance("s", 10).setPickupLocation("foo").
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
assertEquals(10,one.getCapacityDemand());
assertEquals(10,one.getSize().get(0));
}
@Test(expected=IllegalArgumentException.class)
public void whenShipmentIsBuiltWithNegativeDemand_itShouldThrowException(){
@SuppressWarnings("unused")
Shipment one = Shipment.Builder.newInstance("s", -10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, -10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
}
@Test(expected=IllegalArgumentException.class)
@ -53,42 +52,42 @@ public class ShipmentTest {
@Test(expected=IllegalArgumentException.class)
public void whenIdIsNull_itShouldThrowException(){
@SuppressWarnings("unused")
Shipment one = Shipment.Builder.newInstance(null, 10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
Shipment one = Shipment.Builder.newInstance(null).addSizeDimension(0, 10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
}
@Test
public void whenCallingForANewBuilderInstance_itShouldReturnBuilderCorrectly(){
Shipment.Builder builder = Shipment.Builder.newInstance("s", 0);
Shipment.Builder builder = Shipment.Builder.newInstance("s");
assertNotNull(builder);
}
@Test(expected=IllegalStateException.class)
public void whenNeitherPickupLocationIdNorPickupCoord_itThrowsException(){
@SuppressWarnings("unused")
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").build();
}
@Test(expected=IllegalStateException.class)
public void whenNeitherDeliveryLocationIdNorDeliveryCoord_itThrowsException(){
@SuppressWarnings("unused")
Shipment s = Shipment.Builder.newInstance("s", 0).setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setPickupLocation("pickLoc").build();
}
@Test
public void whenPickupLocationIdIsSet_itShouldBeDoneCorrectly(){
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals("pickLoc",s.getPickupLocation());
}
@Test(expected=IllegalArgumentException.class)
public void whenPickupLocationIsNull_itThrowsException(){
@SuppressWarnings("unused")
Shipment.Builder builder = Shipment.Builder.newInstance("s", 0).setPickupLocation(null);
Shipment.Builder builder = Shipment.Builder.newInstance("s").setPickupLocation(null);
}
@Test
public void whenPickupCoordIsSet_itShouldBeDoneCorrectly(){
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").setPickupCoord(Coordinate.newInstance(1, 2)).build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").setPickupCoord(Coordinate.newInstance(1, 2)).build();
assertEquals(1.0,s.getPickupCoord().getX(),0.01);
assertEquals(2.0,s.getPickupCoord().getY(),0.01);
}
@ -96,24 +95,24 @@ public class ShipmentTest {
@Test(expected=IllegalArgumentException.class)
public void whenPickupCoordIsNull_itThrowsException(){
@SuppressWarnings("unused")
Shipment.Builder builder = Shipment.Builder.newInstance("s", 0).setPickupCoord(null);
Shipment.Builder builder = Shipment.Builder.newInstance("s").setPickupCoord(null);
}
@Test
public void whenDeliveryLocationIdIsSet_itShouldBeDoneCorrectly(){
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals("delLoc",s.getDeliveryLocation());
}
@Test(expected=IllegalArgumentException.class)
public void whenDeliveryLocationIsNull_itThrowsException(){
@SuppressWarnings("unused")
Shipment.Builder builder = Shipment.Builder.newInstance("s", 0).setDeliveryLocation(null);
Shipment.Builder builder = Shipment.Builder.newInstance("s").setDeliveryLocation(null);
}
@Test
public void whenDeliveryCoordIsSet_itShouldBeDoneCorrectly(){
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").setDeliveryCoord(Coordinate.newInstance(1, 2)).build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").setDeliveryCoord(Coordinate.newInstance(1, 2)).build();
assertEquals(1.0,s.getDeliveryCoord().getX(),0.01);
assertEquals(2.0,s.getDeliveryCoord().getY(),0.01);
}
@ -121,48 +120,48 @@ public class ShipmentTest {
@Test(expected=IllegalArgumentException.class)
public void whenDeliveryCoordIsNull_itThrowsException(){
@SuppressWarnings("unused")
Shipment.Builder builder = Shipment.Builder.newInstance("s", 0).setDeliveryCoord(null);
Shipment.Builder builder = Shipment.Builder.newInstance("s").setDeliveryCoord(null);
}
@Test
public void whenPickupServiceTimeIsNotSet_itShouldBeZero(){
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(0.0,s.getPickupServiceTime(),0.01);
}
@Test
public void whenDeliveryServiceTimeIsNotSet_itShouldBeZero(){
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(0.0,s.getDeliveryServiceTime(),0.01);
}
@Test
public void whenPickupServiceTimeIsSet_itShouldBeDoneCorrectly(){
Shipment s = Shipment.Builder.newInstance("s", 0).setPickupServiceTime(2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setPickupServiceTime(2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(2.0,s.getPickupServiceTime(),0.01);
}
@Test(expected=IllegalArgumentException.class)
public void whenPickupServiceIsSmallerThanZero_itShouldThrowException(){
@SuppressWarnings("unused")
Shipment s = Shipment.Builder.newInstance("s", 0).setPickupServiceTime(-2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setPickupServiceTime(-2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
}
@Test
public void whenDeliveryServiceTimeIsSet_itShouldBeDoneCorrectly(){
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryServiceTime(2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryServiceTime(2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(2.0,s.getDeliveryServiceTime(),0.01);
}
@Test(expected=IllegalArgumentException.class)
public void whenDeliveryServiceIsSmallerThanZero_itShouldThrowException(){
@SuppressWarnings("unused")
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryServiceTime(-2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryServiceTime(-2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
}
@Test
public void whenPickupTimeWindowIsNotSet_itShouldBeTheDefaultOne(){
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(0.0,s.getPickupTimeWindow().getStart(),0.01);
assertEquals(Double.MAX_VALUE,s.getPickupTimeWindow().getEnd(),0.01);
}
@ -170,19 +169,19 @@ public class ShipmentTest {
@Test(expected=IllegalArgumentException.class)
public void whenPickupTimeWindowIsNull_itShouldThrowException(){
@SuppressWarnings("unused")
Shipment s = Shipment.Builder.newInstance("s", 0).setPickupTimeWindow(null).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setPickupTimeWindow(null).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
}
@Test
public void whenPickupTimeWindowIsSet_itShouldBeDoneCorrectly(){
Shipment s = Shipment.Builder.newInstance("s", 0).setPickupTimeWindow(TimeWindow.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setPickupTimeWindow(TimeWindow.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(1.0,s.getPickupTimeWindow().getStart(),0.01);
assertEquals(2.0,s.getPickupTimeWindow().getEnd(),0.01);
}
@Test
public void whenDeliveryTimeWindowIsNotSet_itShouldBeTheDefaultOne(){
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(0.0,s.getDeliveryTimeWindow().getStart(),0.01);
assertEquals(Double.MAX_VALUE,s.getDeliveryTimeWindow().getEnd(),0.01);
}
@ -190,12 +189,12 @@ public class ShipmentTest {
@Test(expected=IllegalArgumentException.class)
public void whenDeliveryTimeWindowIsNull_itShouldThrowException(){
@SuppressWarnings("unused")
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryTimeWindow(null).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryTimeWindow(null).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
}
@Test
public void whenDeliveryTimeWindowIsSet_itShouldBeDoneCorrectly(){
Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryTimeWindow(TimeWindow.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
Shipment s = Shipment.Builder.newInstance("s").setDeliveryTimeWindow(TimeWindow.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(1.0,s.getDeliveryTimeWindow().getStart(),0.01);
assertEquals(2.0,s.getDeliveryTimeWindow().getEnd(),0.01);
}
@ -227,9 +226,8 @@ public class ShipmentTest {
@Test
public void whenShipmentIsBuiltWithConstructorWhereSizeIsSpecified_capacityShouldBeSetCorrectly(){
Shipment one = Shipment.Builder.newInstance("s",1).setPickupLocation("foo").setPickupCoord(Coordinate.newInstance(0, 0))
Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocation("foo").setPickupCoord(Coordinate.newInstance(0, 0))
.setDeliveryLocation("foofoo").build();
assertEquals(1,one.getCapacityDemand());
assertEquals(1,one.getSize().getNuOfDimensions());
assertEquals(1,one.getSize().get(0));
}

View file

@ -27,12 +27,6 @@ public class DeliverServiceTest {
assertEquals(-100,deliver.getSize().get(1));
assertEquals(-1000,deliver.getSize().get(2));
}
@SuppressWarnings("deprecation")
@Test
public void whenCallingCapacityDemand_itShouldReturnCapDimWithIndex0(){
assertEquals(-10,deliver.getCapacityDemand());
}
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){

View file

@ -30,12 +30,6 @@ public class DeliverShipmentTest {
assertEquals(-1000,deliver.getSize().get(2));
}
@SuppressWarnings("deprecation")
@Test
public void whenCallingCapacityDemand_itShouldReturnCapDimWithIndex0(){
assertEquals(-10,deliver.getCapacityDemand());
}
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
assertEquals(3.,deliver.getTheoreticalEarliestOperationStartTime(),0.01);

View file

@ -13,12 +13,6 @@ public class EndTest {
assertEquals(0,end.getSize().get(0));
}
@Test
public void whenCallingCapacityDemand_itShouldReturnEmptyCapacity(){
End end = End.newInstance("loc", 0., 0.);
assertEquals(0,end.getCapacityDemand());
}
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
End end = End.newInstance("loc", 1., 2.);

View file

@ -28,11 +28,6 @@ public class PickupServiceTest {
assertEquals(1000,pickup.getSize().get(2));
}
@SuppressWarnings("deprecation")
@Test
public void whenCallingCapacityDemand_itShouldReturnCapDimWithIndex0(){
assertEquals(10,pickup.getCapacityDemand());
}
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){

View file

@ -30,12 +30,6 @@ public class PickupShipmentTest {
assertEquals(1000,pickup.getSize().get(2));
}
@SuppressWarnings("deprecation")
@Test
public void whenCallingCapacityDemand_itShouldReturnCapDimWithIndex0(){
assertEquals(10,pickup.getCapacityDemand());
}
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
assertEquals(1.,pickup.getTheoreticalEarliestOperationStartTime(),0.01);

View file

@ -48,12 +48,6 @@ public class ServiceActivityTest {
}
@SuppressWarnings("deprecation")
@Test
public void whenCallingCapacityDemand_itShouldReturnCapDimWithIndex0(){
assertEquals(10,serviceActivity.getCapacityDemand());
}
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
assertEquals(1.,serviceActivity.getTheoreticalEarliestOperationStartTime(),0.01);

View file

@ -11,12 +11,6 @@ public class StartTest {
Start start = Start.newInstance("loc", 0., 0.);
assertEquals(0,start.getSize().get(0));
}
@Test
public void whenCallingCapacityDemand_itShouldReturnEmptyCapacity(){
Start start = Start.newInstance("loc", 0., 0.);
assertEquals(0,start.getCapacityDemand());
}
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){

View file

@ -1,35 +1,18 @@
package jsprit.core.problem.vehicle;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import jsprit.core.problem.vehicle.VehicleImpl.NoVehicle;
import jsprit.core.util.Coordinate;
import org.junit.Test;
@SuppressWarnings("deprecation") // still tests whether deprecated methods work correctly - if deprecated methods are removed entirely, shift to setStartLocationId(..) and setStartLocationCoordinate()
public class VehicleImplTest {
@Test
public void whenSettingTypeWithBuilder_typeShouldBeSet(){
VehicleType type = mock(VehicleType.class);
Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type).build();
assertEquals(type,v.getType());
}
@Test(expected=IllegalStateException.class)
public void whenTypeIsNull_itThrowsIllegalStateException(){
@SuppressWarnings("unused")
Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(null).build();
}
@Test
public void whenTypeIsNotSet_defaultTypeIsSet(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationId("loc").build();
assertEquals("default",v.getType().getTypeId());
assertEquals(0,v.getType().getCapacity());
}
@Test(expected=IllegalStateException.class)
public void whenVehicleIsBuiltWithoutSettingNeitherLocationNorCoord_itThrowsAnIllegalStateException(){
@ -37,58 +20,52 @@ public class VehicleImplTest {
Vehicle v = VehicleImpl.Builder.newInstance("v").build();
}
@Test
public void whenVehicleIsBuiltAndReturnToDepotFlagIsNotSet_itShouldReturnToDepot(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationId("loc").build();
assertTrue(v.isReturnToDepot());
}
@Test
public void whenVehicleIsBuiltToReturnToDepot_itShouldReturnToDepot(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setReturnToDepot(true).setLocationId("loc").build();
Vehicle v = VehicleImpl.Builder.newInstance("v").setReturnToDepot(true).setStartLocationId("loc").build();
assertTrue(v.isReturnToDepot());
}
@Test
public void whenVehicleIsBuiltToNotReturnToDepot_itShouldNotReturnToDepot(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setReturnToDepot(false).setLocationId("loc").build();
Vehicle v = VehicleImpl.Builder.newInstance("v").setReturnToDepot(false).setStartLocationId("loc").build();
assertFalse(v.isReturnToDepot());
}
@Test
public void whenVehicleIsBuiltWithLocation_itShouldHvTheCorrectLocation(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationId("loc").build();
assertEquals("loc",v.getLocationId());
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").build();
assertEquals("loc",v.getStartLocationId());
}
@Test
public void whenVehicleIsBuiltWithCoord_itShouldHvTheCorrectCoord(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationCoord(Coordinate.newInstance(1, 2)).build();
assertEquals(1.0,v.getCoord().getX(),0.01);
assertEquals(2.0,v.getCoord().getY(),0.01);
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationCoordinate(Coordinate.newInstance(1, 2)).build();
assertEquals(1.0,v.getStartLocationCoordinate().getX(),0.01);
assertEquals(2.0,v.getStartLocationCoordinate().getY(),0.01);
}
@Test
public void whenVehicleIsBuiltAndEarliestStartIsNotSet_itShouldSetTheDefaultOfZero(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationCoord(Coordinate.newInstance(1, 2)).build();
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationCoordinate(Coordinate.newInstance(1, 2)).build();
assertEquals(0.0,v.getEarliestDeparture(),0.01);
}
@Test
public void whenVehicleIsBuiltAndEarliestStartSet_itShouldBeSetCorrectly(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setEarliestStart(10.0).setLocationCoord(Coordinate.newInstance(1, 2)).build();
Vehicle v = VehicleImpl.Builder.newInstance("v").setEarliestStart(10.0).setStartLocationCoordinate(Coordinate.newInstance(1, 2)).build();
assertEquals(10.0,v.getEarliestDeparture(),0.01);
}
@Test
public void whenVehicleIsBuiltAndLatestArrivalIsNotSet_itShouldSetDefaultOfDoubleMaxValue(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationCoord(Coordinate.newInstance(1, 2)).build();
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationCoordinate(Coordinate.newInstance(1, 2)).build();
assertEquals(Double.MAX_VALUE,v.getLatestArrival(),0.01);
}
@Test
public void whenVehicleIsBuiltAndLatestArrivalIsSet_itShouldBeSetCorrectly(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setLatestArrival(30.0).setLocationCoord(Coordinate.newInstance(1, 2)).build();
Vehicle v = VehicleImpl.Builder.newInstance("v").setLatestArrival(30.0).setStartLocationCoordinate(Coordinate.newInstance(1, 2)).build();
assertEquals(30.0,v.getLatestArrival(),0.01);
}
@ -102,7 +79,6 @@ public class VehicleImplTest {
@Test
public void whenStartLocationIsSet_itIsDoneCorrectly(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationId("startLoc").build();
assertEquals("startLoc", v.getLocationId());
assertEquals("startLoc", v.getStartLocationId());
}
@ -117,9 +93,6 @@ public class VehicleImplTest {
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationCoordinate(Coordinate.newInstance(1, 2)).build();
assertEquals(1.0, v.getStartLocationCoordinate().getX(),0.01);
assertEquals(2.0, v.getStartLocationCoordinate().getY(),0.01);
assertEquals(1.0, v.getCoord().getX(),0.01);
assertEquals(2.0, v.getCoord().getY(),0.01);
}
@Test

View file

@ -5,7 +5,6 @@ import static org.junit.Assert.*;
import org.junit.Test;
public class VehicleTypeImplTest {
@Test(expected=IllegalArgumentException.class)
public void whenTypeHasNegativeCapacityVal_throwIllegalStateExpception(){
@ -44,47 +43,34 @@ public class VehicleTypeImplTest {
assertEquals(0,type.getCapacityDimensions().get(0));
}
@SuppressWarnings("deprecation")
@Test
public void whenTypeIsBuiltWithConstructorWhereSizeIsSpecified_capacityShouldBeSetCorrectly(){
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("t",20).build();
assertEquals(20,type.getCapacity());
assertEquals(20,type.getCapacityDimensions().get(0));
}
@SuppressWarnings("deprecation")
@Test
public void whenCallingStaticNewBuilderInstance_itShouldReturnNewBuilderInstance(){
VehicleTypeImpl.Builder builder = VehicleTypeImpl.Builder.newInstance("foo", 0);
VehicleTypeImpl.Builder builder = VehicleTypeImpl.Builder.newInstance("foo");
assertNotNull(builder);
}
@SuppressWarnings("deprecation")
@Test
public void whenBuildingTypeJustByCallingNewInstance_typeIdMustBeCorrect(){
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo", 0).build();
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo").build();
assertEquals("foo",type.getTypeId());
}
@SuppressWarnings("deprecation")
@Test
public void whenBuildingTypeJustByCallingNewInstance_capMustBeCorrect(){
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo", 0).build();
assertEquals(0,type.getCapacity());
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo").build();
assertEquals(0,type.getCapacityDimensions().get(0));
}
@SuppressWarnings("deprecation")
@Test(expected=IllegalStateException.class)
@Test(expected=IllegalArgumentException.class)
public void whenBuildingTypeWithCapSmallerThanZero_throwIllegalStateException(){
@SuppressWarnings("unused")
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo", -10).build();
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo").addCapacityDimension(0, -10).build();
}
@SuppressWarnings("deprecation")
@Test(expected=IllegalStateException.class)
public void whenBuildingTypeWithNullId_throwIllegalStateException(){
@SuppressWarnings("unused")
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance(null, 10).build();
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance(null).addCapacityDimension(0, 10).build();
}

View file

@ -194,7 +194,9 @@
</timeWindow>
</timeWindows>
</delivery>
<capacity-demand>10</capacity-demand>
<capacity-dimensions>
<dimension index="0">10</dimension>
</capacity-dimensions>
</shipment>
<shipment id="4">

View file

@ -3,7 +3,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
<fleetComposition>HETEROGENEOUS</fleetComposition>
</problemType>
<vehicles>
<vehicle>
@ -41,7 +40,7 @@
<returnToDepot>false</returnToDepot>
</vehicle>
<vehicle>
<id>v4</id>
<id>v3</id>
<typeId>vehType2</typeId>
<startLocation>
<id>startLoc</id>
@ -58,7 +57,7 @@
<returnToDepot>true</returnToDepot>
</vehicle>
<vehicle>
<id>v3</id>
<id>v4</id>
<typeId>vehType2</typeId>
<startLocation>
<id>startLoc</id>

View file

@ -3,7 +3,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>INFINITE</fleetSize>
<fleetComposition>HOMOGENEOUS</fleetComposition>
</problemType>
<vehicles>
<vehicle>