@Test void createVehicle() { final long vehicleId = 63; final String name = "Veh5"; final int capacity = 101; VehicleData vehicleData = VehicleFactory.vehicleData(name, capacity); final Vehicle vehicle = VehicleFactory.createVehicle(vehicleId, name, capacity); when(vehicleRepository.createVehicle(vehicleData)).thenReturn(vehicle); vehicleService.createVehicle(vehicleData); verify(optimizer).addVehicle(vehicle); }
public void createVehicle() { Vehicle vehicle = vehicleRepository.createVehicle(DEFAULT_VEHICLE_CAPACITY); addVehicle(vehicle); }
VehicleService { public void createVehicle() { Vehicle vehicle = vehicleRepository.createVehicle(DEFAULT_VEHICLE_CAPACITY); addVehicle(vehicle); } }
VehicleService { public void createVehicle() { Vehicle vehicle = vehicleRepository.createVehicle(DEFAULT_VEHICLE_CAPACITY); addVehicle(vehicle); } @Autowired  VehicleService(RouteOptimizer optimizer, VehicleRepository vehicleRepository); }
VehicleService { public void createVehicle() { Vehicle vehicle = vehicleRepository.createVehicle(DEFAULT_VEHICLE_CAPACITY); addVehicle(vehicle); } @Autowired  VehicleService(RouteOptimizer optimizer, VehicleRepository vehicleRepository); void createVehicle(); void createVehicle(VehicleData vehicleData); void addVehicle(Vehicle vehicle); void removeVehicle(long vehicleId); synchronized void removeAnyVehicle(); void removeAll(); void changeCapacity(long vehicleId, int capacity); }
VehicleService { public void createVehicle() { Vehicle vehicle = vehicleRepository.createVehicle(DEFAULT_VEHICLE_CAPACITY); addVehicle(vehicle); } @Autowired  VehicleService(RouteOptimizer optimizer, VehicleRepository vehicleRepository); void createVehicle(); void createVehicle(VehicleData vehicleData); void addVehicle(Vehicle vehicle); void removeVehicle(long vehicleId); synchronized void removeAnyVehicle(); void removeAll(); void changeCapacity(long vehicleId, int capacity);  }