@Test void fail_fast_if_vehicles_next_visit_doesnt_exist() { PlanningVehicle vehicle = testVehicle(1); vehicle.setNextVisit(testVisit(2)); VehicleRoutingSolution solution = solutionFromVisits( singletonList(vehicle), new PlanningDepot(testLocation(1)), singletonList(testVisit(3))); assertThatIllegalArgumentException() .isThrownBy(() -> RouteChangedEventPublisher.solutionToEvent(solution, this)) .withMessageContaining("Visit"); }
static RouteChangedEvent solutionToEvent(VehicleRoutingSolution solution, Object source) { List<ShallowRoute> routes = routes(solution); return new RouteChangedEvent( source, Distance.ofMillis(-solution.getScore().getSoftScore()), vehicleIds(solution), depotId(solution), visitIds(solution), routes); }
RouteChangedEventPublisher { static RouteChangedEvent solutionToEvent(VehicleRoutingSolution solution, Object source) { List<ShallowRoute> routes = routes(solution); return new RouteChangedEvent( source, Distance.ofMillis(-solution.getScore().getSoftScore()), vehicleIds(solution), depotId(solution), visitIds(solution), routes); } }
RouteChangedEventPublisher { static RouteChangedEvent solutionToEvent(VehicleRoutingSolution solution, Object source) { List<ShallowRoute> routes = routes(solution); return new RouteChangedEvent( source, Distance.ofMillis(-solution.getScore().getSoftScore()), vehicleIds(solution), depotId(solution), visitIds(solution), routes); } @Autowired  RouteChangedEventPublisher(ApplicationEventPublisher eventPublisher); }
RouteChangedEventPublisher { static RouteChangedEvent solutionToEvent(VehicleRoutingSolution solution, Object source) { List<ShallowRoute> routes = routes(solution); return new RouteChangedEvent( source, Distance.ofMillis(-solution.getScore().getSoftScore()), vehicleIds(solution), depotId(solution), visitIds(solution), routes); } @Autowired  RouteChangedEventPublisher(ApplicationEventPublisher eventPublisher);  }
RouteChangedEventPublisher { static RouteChangedEvent solutionToEvent(VehicleRoutingSolution solution, Object source) { List<ShallowRoute> routes = routes(solution); return new RouteChangedEvent( source, Distance.ofMillis(-solution.getScore().getSoftScore()), vehicleIds(solution), depotId(solution), visitIds(solution), routes); } @Autowired  RouteChangedEventPublisher(ApplicationEventPublisher eventPublisher);   }