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

shift from vehicle.getLocation() to vehicle.getStartLocation() and

vehicle.getCoord() to vehicle.getStartLocationCoordinate()
This commit is contained in:
Stefan Schroeder 2014-01-28 17:40:13 +01:00
parent e5dabbdf64
commit a234bb54c9
36 changed files with 195 additions and 137 deletions

View file

@ -53,8 +53,8 @@ public class CalcVehicleTypeDependentServiceInsertionTest {
veh2 = mock(Vehicle.class);
when(veh1.getType()).thenReturn(VehicleTypeImpl.Builder.newInstance("type1", 0).build());
when(veh2.getType()).thenReturn(VehicleTypeImpl.Builder.newInstance("type2", 0).build());
when(veh1.getLocationId()).thenReturn("loc1");
when(veh2.getLocationId()).thenReturn("loc2");
when(veh1.getStartLocationId()).thenReturn("loc1");
when(veh2.getStartLocationId()).thenReturn("loc2");
fleetManager = mock(VehicleFleetManager.class);
service = mock(Service.class);
vehicleRoute = mock(VehicleRoute.class);

View file

@ -75,14 +75,16 @@ public class TestCalculatesServiceInsertion {
costs = mock(VehicleRoutingTransportCosts.class);
vehicle = mock(Vehicle.class);
when(vehicle.getCapacity()).thenReturn(1000);
when(vehicle.getLocationId()).thenReturn("depot");
when(vehicle.getStartLocationId()).thenReturn("depot");
when(vehicle.getEndLocationId()).thenReturn("depot");
when(vehicle.getEarliestDeparture()).thenReturn(0.0);
when(vehicle.getLatestArrival()).thenReturn(100.0);
when(vehicle.isReturnToDepot()).thenReturn(true);
newVehicle = mock(Vehicle.class);
when(newVehicle.getCapacity()).thenReturn(1000);
when(newVehicle.getLocationId()).thenReturn("depot");
when(newVehicle.getStartLocationId()).thenReturn("depot");
when(newVehicle.getEndLocationId()).thenReturn("depot");
when(newVehicle.getEarliestDeparture()).thenReturn(0.0);
when(newVehicle.getLatestArrival()).thenReturn(100.0);
when(newVehicle.isReturnToDepot()).thenReturn(true);

View file

@ -79,7 +79,6 @@ public class TestCalculatesServiceInsertionOnRouteLevel {
costs = mock(VehicleRoutingTransportCosts.class);
vehicle = mock(Vehicle.class);
when(vehicle.getCapacity()).thenReturn(1000);
when(vehicle.getLocationId()).thenReturn("0,0");
when(vehicle.getStartLocationId()).thenReturn("0,0");
when(vehicle.getEndLocationId()).thenReturn("0,0");
when(vehicle.getEarliestDeparture()).thenReturn(0.0);
@ -88,7 +87,6 @@ public class TestCalculatesServiceInsertionOnRouteLevel {
newVehicle = mock(Vehicle.class);
when(newVehicle.getCapacity()).thenReturn(1000);
when(newVehicle.getLocationId()).thenReturn("0,0");
when(newVehicle.getStartLocationId()).thenReturn("0,0");
when(newVehicle.getEndLocationId()).thenReturn("0,0");
when(newVehicle.getEarliestDeparture()).thenReturn(0.0);

View file

@ -22,7 +22,6 @@ public class TestInserter {
public void whenInsertingServiceAndRouteIsClosed_itInsertsCorrectly(){
Service service = mock(Service.class);
Vehicle vehicle = mock(Vehicle.class);
when(vehicle.getLocationId()).thenReturn("vehLoc");
when(vehicle.getStartLocationId()).thenReturn("vehLoc");
when(vehicle.getEndLocationId()).thenReturn("vehLoc");
when(vehicle.isReturnToDepot()).thenReturn(true);
@ -42,14 +41,13 @@ public class TestInserter {
assertEquals(2,route.getTourActivities().getActivities().size());
assertEquals(route.getTourActivities().getActivities().get(1).getLocationId(),serviceToInsert.getLocationId());
assertEquals(route.getEnd().getLocationId(),vehicle.getLocationId());
assertEquals(route.getEnd().getLocationId(),vehicle.getEndLocationId());
}
@Test
public void whenInsertingServiceAndRouteIsOpen_itInsertsCorrectlyAndSwitchesEndLocation(){
Service service = mock(Service.class);
Vehicle vehicle = mock(Vehicle.class);
when(vehicle.getLocationId()).thenReturn("vehLoc");
when(vehicle.getStartLocationId()).thenReturn("vehLoc");
when(vehicle.getEndLocationId()).thenReturn("vehLoc");
when(vehicle.isReturnToDepot()).thenReturn(false);
@ -76,7 +74,6 @@ public class TestInserter {
public void whenInsertingShipmentAndRouteIsClosed_itInsertsCorrectly(){
Shipment shipment = mock(Shipment.class);
Vehicle vehicle = mock(Vehicle.class);
when(vehicle.getLocationId()).thenReturn("vehLoc");
when(vehicle.getStartLocationId()).thenReturn("vehLoc");
when(vehicle.getEndLocationId()).thenReturn("vehLoc");
when(vehicle.isReturnToDepot()).thenReturn(true);
@ -98,14 +95,13 @@ public class TestInserter {
assertEquals(4,route.getTourActivities().getActivities().size());
assertEquals(route.getTourActivities().getActivities().get(2).getLocationId(),shipmentToInsert.getPickupLocation());
assertEquals(route.getTourActivities().getActivities().get(3).getLocationId(),shipmentToInsert.getDeliveryLocation());
assertEquals(route.getEnd().getLocationId(),vehicle.getLocationId());
assertEquals(route.getEnd().getLocationId(),vehicle.getEndLocationId());
}
@Test
public void whenInsertingShipmentAndRouteIsOpen_itInsertsCorrectlyAndSwitchesEndLocation(){
Shipment shipment = mock(Shipment.class);
Vehicle vehicle = mock(Vehicle.class);
when(vehicle.getLocationId()).thenReturn("vehLoc");
when(vehicle.isReturnToDepot()).thenReturn(false);
when(vehicle.getId()).thenReturn("vehId");
@ -148,7 +144,7 @@ public class TestInserter {
Inserter inserter = new Inserter(mock(InsertionListeners.class));
inserter.insertJob(shipmentToInsert, iData, route);
assertEquals(newVehicle.getLocationId(),route.getEnd().getLocationId());
assertEquals(route.getEnd().getLocationId(),newVehicle.getEndLocationId());
}
@Test

View file

@ -138,7 +138,7 @@ public class TestTourStateUpdaterWithService {
public void testStatesOfAct0(){
states.informInsertionStarts(Arrays.asList(vehicleRoute), null);
assertEquals(0.0, vehicleRoute.getStart().getEndTime(),0.05);
assertEquals(vehicleRoute.getVehicle().getLocationId(), vehicleRoute.getStart().getLocationId());
assertEquals(vehicleRoute.getVehicle().getStartLocationId(), vehicleRoute.getStart().getLocationId());
assertEquals(vehicleRoute.getVehicle().getEarliestDeparture(), vehicleRoute.getStart().getTheoreticalEarliestOperationStartTime(),0.05);
assertEquals(Double.MAX_VALUE, vehicleRoute.getStart().getTheoreticalLatestOperationStartTime(),0.05);

View file

@ -66,10 +66,10 @@ public class VehicleRoutingProblemTest {
public void whenBuildingWithFourVehicles_vrpShouldContainTheCorrectNuOfVehicles(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
Vehicle v1 = mock(VehicleImpl.class);
Vehicle v2 = mock(VehicleImpl.class);
Vehicle v3 = mock(VehicleImpl.class);
Vehicle v4 = mock(VehicleImpl.class);
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("start").build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("start").build();
Vehicle v3 = VehicleImpl.Builder.newInstance("v3").setStartLocationId("start").build();
Vehicle v4 = VehicleImpl.Builder.newInstance("v4").setStartLocationId("start").build();
builder.addVehicle(v1).addVehicle(v2).addVehicle(v3).addVehicle(v4);
@ -82,10 +82,10 @@ public class VehicleRoutingProblemTest {
public void whenAddingFourVehiclesAllAtOnce_vrpShouldContainTheCorrectNuOfVehicles(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
Vehicle v1 = mock(VehicleImpl.class);
Vehicle v2 = mock(VehicleImpl.class);
Vehicle v3 = mock(VehicleImpl.class);
Vehicle v4 = mock(VehicleImpl.class);
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("start").build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("start").build();
Vehicle v3 = VehicleImpl.Builder.newInstance("v3").setStartLocationId("start").build();
Vehicle v4 = VehicleImpl.Builder.newInstance("v4").setStartLocationId("start").build();
builder.addAllVehicles(Arrays.asList(v1,v2,v3,v4));
@ -471,4 +471,22 @@ public class VehicleRoutingProblemTest {
assertTrue(anotherPenVehInCollection);
}
@Test
public void whenAddingVehicleWithDiffStartAndEnd_startLocationMustBeRegisteredInLocationMap(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("end").build();
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
vrpBuilder.addVehicle(vehicle);
assertTrue(vrpBuilder.getLocationMap().containsKey("start"));
}
@Test
public void whenAddingVehicleWithDiffStartAndEnd_endLocationMustBeRegisteredInLocationMap(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("end").build();
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
vrpBuilder.addVehicle(vehicle);
assertTrue(vrpBuilder.getLocationMap().containsKey("end"));
}
}

View file

@ -70,9 +70,9 @@ public class VrpReaderV2Test {
VehicleRoutingProblem vrp = builder.build();
Vehicle v1 = getVehicle("v1",vrp.getVehicles());
assertEquals(20,v1.getCapacity());
assertEquals(100.0,v1.getCoord().getX(),0.01);
assertEquals(100.0,v1.getStartLocationCoordinate().getX(),0.01);
assertEquals(0.0,v1.getEarliestDeparture(),0.01);
assertEquals("depotLoc2",v1.getLocationId());
assertEquals("depotLoc2",v1.getStartLocationId());
assertNotNull(v1.getType());
assertEquals("vehType", v1.getType().getTypeId());
assertEquals(1000.0,v1.getLatestArrival(),0.01);
@ -229,8 +229,8 @@ public class VrpReaderV2Test {
new VrpXMLReader(builder, null).read(inFileName);
VehicleRoutingProblem vrp = builder.build();
Vehicle v3 = getVehicle("v3",vrp.getVehicles());
assertEquals(10.0,v3.getCoord().getX(),0.01);
assertEquals(100.0,v3.getCoord().getY(),0.01);
assertEquals(10.0,v3.getStartLocationCoordinate().getX(),0.01);
assertEquals(100.0,v3.getStartLocationCoordinate().getY(),0.01);
}
@Test
@ -239,7 +239,7 @@ public class VrpReaderV2Test {
new VrpXMLReader(builder, null).read(inFileName);
VehicleRoutingProblem vrp = builder.build();
Vehicle v3 = getVehicle("v3",vrp.getVehicles());
assertEquals("startLoc",v3.getLocationId());
assertEquals("startLoc",v3.getStartLocationId());
}
@Test
@ -286,8 +286,8 @@ public class VrpReaderV2Test {
new VrpXMLReader(builder, null).read(inFileName);
VehicleRoutingProblem vrp = builder.build();
Vehicle v = getVehicle("v4",vrp.getVehicles());
assertEquals(10.0,v.getCoord().getX(),0.01);
assertEquals(100.0,v.getCoord().getY(),0.01);
assertEquals(10.0,v.getStartLocationCoordinate().getX(),0.01);
assertEquals(100.0,v.getStartLocationCoordinate().getY(),0.01);
}
@Test

View file

@ -164,42 +164,49 @@ public class TestVehicleRoute {
}
}
@Test
public void whenBuildingRouteWithVehicleThatHasDifferentStartAndEndLocation_routeMustHaveCorrectStartLocation(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("end").build();
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
assertTrue(vRoute.getStart().getLocationId().equals("start"));
}
@Test
public void whenBuildingRouteWithVehicleThatHasDifferentStartAndEndLocation_routeMustHaveCorrectEndLocation(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("end").build();
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
assertTrue(vRoute.getEnd().getLocationId().equals("end"));
}
@Test
public void whenBuildingRouteWithVehicleThatHasSameStartAndEndLocation_routeMustHaveCorrectStartLocation(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("start").build();
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
assertTrue(vRoute.getStart().getLocationId().equals("start"));
}
@Test
public void whenBuildingRouteWithVehicleThatHasSameStartAndEndLocation_routeMustHaveCorrectEndLocation(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("start").build();
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
assertTrue(vRoute.getEnd().getLocationId().equals("start"));
}
@Test
public void whenBuildingRouteWithVehicleThatHasSameStartAndEndLocation_routeMustHaveCorrectStartLocationV2(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("start").setEndLocationId("start").build();
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
assertTrue(vRoute.getStart().getLocationId().equals("start"));
}
@Test
public void whenBuildingRouteWithVehicleThatHasSameStartAndEndLocation_routeMustHaveCorrectEndLocationV2(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("start").setEndLocationId("start").build();
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
assertTrue(vRoute.getEnd().getLocationId().equals("start"));
}
@Test
public void whenBuildingRouteWithVehicleThatHasDifferentStartAndEndLocation_routeMustHaveCorrectDepartureTime(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setEarliestStart(100).setStartLocationId("start").setEndLocationId("end").build();
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
@ -207,13 +214,14 @@ public class TestVehicleRoute {
assertEquals(vRoute.getStart().getEndTime(),100.0,0.01);
}
@Test
public void whenBuildingRouteWithVehicleThatHasDifferentStartAndEndLocation_routeMustHaveCorrectEndTime(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setEarliestStart(100).setLatestArrival(200).setStartLocationId("start").setEndLocationId("end").build();
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
assertEquals(vRoute.getEnd().getArrTime(),100.0,0.01);
assertEquals(vRoute.getEnd().getTheoreticalLatestOperationStartTime(),100.0,0.01);
assertEquals(200.0,vRoute.getEnd().getTheoreticalLatestOperationStartTime(),0.01);
}
@Test
public void whenSettingDepartureTimeInBetweenEarliestStartAndLatestArr_routeMustHaveCorrectDepartureTime(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setEarliestStart(100).setLatestArrival(200).setStartLocationId("start").setEndLocationId("end").build();
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
@ -222,6 +230,7 @@ public class TestVehicleRoute {
assertEquals(vRoute.getDepartureTime(),150.0,0.01);
}
@Test
public void whenSettingDepartureEarlierThanEarliestStart_routeMustHaveEarliestDepTimeAsDepTime(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setEarliestStart(100).setLatestArrival(200).setStartLocationId("start").setEndLocationId("end").build();
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
@ -230,6 +239,7 @@ public class TestVehicleRoute {
assertEquals(vRoute.getDepartureTime(),100.0,0.01);
}
@Test
public void whenSettingDepartureTimeLaterThanLatestArrival_routeMustHaveThisDepTime(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setEarliestStart(100).setLatestArrival(200).setStartLocationId("start").setEndLocationId("end").build();
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
@ -238,12 +248,14 @@ public class TestVehicleRoute {
assertEquals(vRoute.getDepartureTime(),100.0,0.01);
}
@Test
public void whenCreatingEmptyRoute_itMustReturnEmptyRoute(){
@SuppressWarnings("unused")
VehicleRoute route = VehicleRoute.emptyRoute();
assertTrue(true);
}
@Test
public void whenIniRouteWithNewVehicle_startLocationMustBeCorrect(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setEarliestStart(100).setLatestArrival(200).setStartLocationId("start").setEndLocationId("end").build();
Vehicle new_vehicle = VehicleImpl.Builder.newInstance("new_v").setEarliestStart(1000).setLatestArrival(2000).setStartLocationId("new_start").setEndLocationId("new_end").build();
@ -252,14 +264,16 @@ public class TestVehicleRoute {
assertEquals("new_start",vRoute.getStart().getLocationId());
}
@Test
public void whenIniRouteWithNewVehicle_endLocationMustBeCorrect(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setEarliestStart(100).setLatestArrival(200).setStartLocationId("start").setEndLocationId("end").build();
Vehicle new_vehicle = VehicleImpl.Builder.newInstance("new_v").setEarliestStart(1000).setLatestArrival(2000).setStartLocationId("new_start").setEndLocationId("new_end").build();
VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
vRoute.setVehicleAndDepartureTime(new_vehicle, 50.0);
assertEquals("new_end",vRoute.getStart().getLocationId());
assertEquals("new_end",vRoute.getEnd().getLocationId());
}
@Test
public void whenIniRouteWithNewVehicle_depTimeMustBeEarliestDepTimeOfNewVehicle(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setEarliestStart(100).setLatestArrival(200).setStartLocationId("start").setEndLocationId("end").build();
Vehicle new_vehicle = VehicleImpl.Builder.newInstance("new_v").setEarliestStart(1000).setLatestArrival(2000).setStartLocationId("new_start").setEndLocationId("new_end").build();
@ -268,6 +282,7 @@ public class TestVehicleRoute {
assertEquals(1000.0,vRoute.getDepartureTime(),0.01);
}
@Test
public void whenIniRouteWithNewVehicle_depTimeMustBeSetDepTime(){
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setEarliestStart(100).setLatestArrival(200).setStartLocationId("start").setEndLocationId("end").build();
Vehicle new_vehicle = VehicleImpl.Builder.newInstance("new_v").setEarliestStart(1000).setLatestArrival(2000).setStartLocationId("new_start").setEndLocationId("new_end").build();

View file

@ -65,14 +65,15 @@ public class VehicleRouteBuilderTest {
Shipment s2 = mock(Shipment.class);
Vehicle vehicle = mock(Vehicle.class);
when(vehicle.isReturnToDepot()).thenReturn(true);
when(vehicle.getLocationId()).thenReturn("vehLoc");
when(vehicle.getStartLocationId()).thenReturn("vehLoc");
when(vehicle.getEndLocationId()).thenReturn("vehLoc");
VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
builder.addPickup(s);
builder.addPickup(s2);
builder.addDelivery(s);
builder.addDelivery(s2);
VehicleRoute route = builder.build();
assertEquals(route.getEnd().getLocationId(), vehicle.getLocationId());
assertEquals("vehLoc",route.getEnd().getLocationId());
}
@Test
@ -82,7 +83,7 @@ public class VehicleRouteBuilderTest {
when(s2.getDeliveryLocation()).thenReturn("delLoc");
Vehicle vehicle = mock(Vehicle.class);
when(vehicle.isReturnToDepot()).thenReturn(false);
when(vehicle.getLocationId()).thenReturn("vehLoc");
when(vehicle.getStartLocationId()).thenReturn("vehLoc");
VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
builder.addPickup(s);
builder.addPickup(s2);
@ -99,7 +100,7 @@ public class VehicleRouteBuilderTest {
when(s2.getDeliveryLocation()).thenReturn("delLoc");
Vehicle vehicle = mock(Vehicle.class);
when(vehicle.isReturnToDepot()).thenReturn(false);
when(vehicle.getLocationId()).thenReturn("vehLoc");
when(vehicle.getStartLocationId()).thenReturn("vehLoc");
VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
builder.addPickup(s);
builder.addPickup(s2);
@ -119,7 +120,7 @@ public class VehicleRouteBuilderTest {
when(s2.getDeliveryLocation()).thenReturn("delLoc");
Vehicle vehicle = mock(Vehicle.class);
when(vehicle.isReturnToDepot()).thenReturn(false);
when(vehicle.getLocationId()).thenReturn("vehLoc");
when(vehicle.getStartLocationId()).thenReturn("vehLoc");
when(vehicle.getLatestArrival()).thenReturn(200.0);
VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
builder.addPickup(s);

View file

@ -121,12 +121,6 @@ public class VehicleImplTest {
assertEquals(2.0, v.getCoord().getY(),0.01);
}
@Test(expected=IllegalArgumentException.class)
public void whenStartLocationCoordIsNull_itThrowsException(){
@SuppressWarnings("unused")
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationCoordinate(null).build();
}
@Test
public void whenEndLocationIsSet_itIsDoneCorrectly(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationId("startLoc").setEndLocationId("endLoc").build();
@ -134,12 +128,6 @@ public class VehicleImplTest {
assertEquals("endLoc", v.getEndLocationId());
}
@Test(expected=IllegalArgumentException.class)
public void whenEndLocationIsNull_itThrowsException(){
@SuppressWarnings("unused")
Vehicle v = VehicleImpl.Builder.newInstance("v").setEndLocationId(null).build();
}
@Test
public void whenEndLocationCoordIsSet_itIsDoneCorrectly(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationId("startLoc").setEndLocationCoordinate(Coordinate.newInstance(1, 2)).build();
@ -147,12 +135,7 @@ public class VehicleImplTest {
assertEquals(2.0, v.getEndLocationCoordinate().getY(),0.01);
}
@Test(expected=IllegalArgumentException.class)
public void whenEndLocationCoordIsNull_itThrowsException(){
@SuppressWarnings("unused")
Vehicle v = VehicleImpl.Builder.newInstance("v").setEndLocationCoordinate(null).build();
}
@Test
public void whenNeitherEndLocationIdNorEndLocationCoordAreSet_endLocationIdMustBeEqualToStartLocationId(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationId("startLoc").build();