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

test VehicleFleetManagers

This commit is contained in:
oblonski 2014-01-15 21:18:00 -05:00
parent d41ad158cd
commit 937702e136
3 changed files with 22 additions and 2 deletions

View file

@ -27,7 +27,6 @@ public class FiniteFleetManagerFactory implements VehicleFleetManagerFactory{
private Collection<Vehicle> vehicles;
/**
* Constucts the factory.
*
@ -40,9 +39,14 @@ public class FiniteFleetManagerFactory implements VehicleFleetManagerFactory{
/**
* Creates the finite fleetmanager.
*
* @return VehicleFleetManager
* @throws IllegalStateManager if vehicles == null or vehicles.isEmpty()
*/
@Override
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);
}

View file

@ -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();
}
}

View file

@ -28,7 +28,7 @@ import jsprit.core.problem.vehicle.VehicleImpl;
import jsprit.core.problem.vehicle.VehicleTypeImpl;
import junit.framework.TestCase;
public class TestVehicleFleetManager extends TestCase{
public class TestVehicleFleetManagerImpl extends TestCase{
VehicleFleetManager fleetManager;