RouteChangedEventPublisher { void publishSolution(VehicleRoutingSolution solution) { RouteChangedEvent event = solutionToEvent(solution, this); logger.info( "New solution with {} depots, {} vehicles, {} visits, distance: {}, score: {}", solution.getDepotList().size(), solution.getVehicleList().size(), solution.getVisitList().size(), event.distance(), solution.getScore()); logger.debug("Routes: {}", event.routes()); eventPublisher.publishEvent(event); } @Autowired  RouteChangedEventPublisher(ApplicationEventPublisher eventPublisher);   }
@Test void should_covert_solution_to_event_and_publish_it() { routeChangedEventPublisher.publishSolution(SolutionFactory.emptySolution()); verify(publisher).publishEvent(any(RouteChangedEvent.class)); }