@Test void vehicle_without_a_depot_is_illegal_if_depot_exists() { PlanningDepot depot = new PlanningDepot(testLocation(1)); PlanningVehicle vehicle = testVehicle(1); VehicleRoutingSolution solution = solutionFromVisits(singletonList(vehicle), depot, emptyList()); vehicle.setDepot(null); assertThatIllegalArgumentException() .isThrownBy(() -> RouteChangedEventPublisher.solutionToEvent(solution, this)) .withMessageContaining("Vehicle"); }
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);   }