mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
test VehicleFleetManagers
This commit is contained in:
parent
d41ad158cd
commit
937702e136
3 changed files with 22 additions and 2 deletions
|
|
@ -27,7 +27,6 @@ public class FiniteFleetManagerFactory implements VehicleFleetManagerFactory{
|
||||||
|
|
||||||
private Collection<Vehicle> vehicles;
|
private Collection<Vehicle> vehicles;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constucts the factory.
|
* Constucts the factory.
|
||||||
*
|
*
|
||||||
|
|
@ -40,9 +39,14 @@ public class FiniteFleetManagerFactory implements VehicleFleetManagerFactory{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the finite fleetmanager.
|
* Creates the finite fleetmanager.
|
||||||
|
*
|
||||||
|
* @return VehicleFleetManager
|
||||||
|
* @throws IllegalStateManager if vehicles == null or vehicles.isEmpty()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public VehicleFleetManager createFleetManager() {
|
public VehicleFleetManager createFleetManager() {
|
||||||
|
if(vehicles == null) throw new IllegalStateException("vehicles is null. this must not be.");
|
||||||
|
if(vehicles.isEmpty()) throw new IllegalStateException("vehicle-collection is empty. this must not be");
|
||||||
return new VehicleFleetManagerImpl(vehicles);
|
return new VehicleFleetManagerImpl(vehicles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package jsprit.core.problem.vehicle;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.*;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class FiniteVehicleFleetManagerFactoryTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenFiniteVehicleManagerIsCreated_itShouldReturnCorrectManager(){
|
||||||
|
VehicleFleetManager vfm = new FiniteFleetManagerFactory(Arrays.asList(mock(Vehicle.class))).createFleetManager();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -28,7 +28,7 @@ import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
public class TestVehicleFleetManager extends TestCase{
|
public class TestVehicleFleetManagerImpl extends TestCase{
|
||||||
|
|
||||||
VehicleFleetManager fleetManager;
|
VehicleFleetManager fleetManager;
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue