VehicleService { public void addVehicle(Vehicle vehicle) { optimizer.addVehicle(Objects.requireNonNull(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);  }
@Test void addVehicle_should_validate_arguments() { assertThatNullPointerException().isThrownBy(() -> vehicleService.addVehicle(null)); }
@Test void addVehicle() { final Vehicle vehicle = VehicleFactory.testVehicle(1); vehicleService.addVehicle(vehicle); verifyNoInteractions(vehicleRepository); verify(optimizer).addVehicle(vehicle); }