@Test void subscribeToRouteTopic() { Distance distance = Distance.ofMillis(987_654_321); Location depot = new Location(1, Coordinates.valueOf(3, 5)); Vehicle vehicle = VehicleFactory.createVehicle(1, "vehicle", 77); Location visit = new Location(2, Coordinates.valueOf(321, 123)); Route route = new Route(vehicle, depot, singletonList(visit)); Coordinates pointOnTrack = Coordinates.valueOf(0, 0); RouteWithTrack routeWithTrack = new RouteWithTrack(route, singletonList(singletonList(pointOnTrack))); RoutingPlan plan = new RoutingPlan( distance, singletonList(vehicle), depot, singletonList(visit), singletonList(routeWithTrack)); when(routeListener.getBestRoutingPlan()).thenReturn(plan); PortableRoutingPlan portableRoutingPlan = webSocketController.subscribeToRouteTopic(); assertThat(portableRoutingPlan.getDistance()).isEqualTo(PortableDistance.fromDistance(distance)); assertThat(portableRoutingPlan.getVisits()).containsExactly(PortableLocation.fromLocation(visit)); assertThat(portableRoutingPlan.getVehicles()).containsExactly(PortableVehicle.fromVehicle(vehicle)); assertThat(portableRoutingPlan.getDepot()).isEqualTo(PortableLocation.fromLocation(depot)); assertThat(portableRoutingPlan.getRoutes()).hasSize(1); }
@SubscribeMapping("/route") PortableRoutingPlan subscribeToRouteTopic() { RoutingPlan routingPlan = routeListener.getBestRoutingPlan(); return PortableRoutingPlanFactory.fromRoutingPlan(routingPlan); }
WebSocketController { @SubscribeMapping("/route") PortableRoutingPlan subscribeToRouteTopic() { RoutingPlan routingPlan = routeListener.getBestRoutingPlan(); return PortableRoutingPlanFactory.fromRoutingPlan(routingPlan); } }
WebSocketController { @SubscribeMapping("/route") PortableRoutingPlan subscribeToRouteTopic() { RoutingPlan routingPlan = routeListener.getBestRoutingPlan(); return PortableRoutingPlanFactory.fromRoutingPlan(routingPlan); } @Autowired  WebSocketController(
            RouteListener routeListener,
            RegionService regionService,
            LocationService locationService,
            VehicleService vehicleService,
            DemoService demoService,
            ApplicationEventPublisher eventPublisher); }
WebSocketController { @SubscribeMapping("/route") PortableRoutingPlan subscribeToRouteTopic() { RoutingPlan routingPlan = routeListener.getBestRoutingPlan(); return PortableRoutingPlanFactory.fromRoutingPlan(routingPlan); } @Autowired  WebSocketController(
            RouteListener routeListener,
            RegionService regionService,
            LocationService locationService,
            VehicleService vehicleService,
            DemoService demoService,
            ApplicationEventPublisher eventPublisher);  }
WebSocketController { @SubscribeMapping("/route") PortableRoutingPlan subscribeToRouteTopic() { RoutingPlan routingPlan = routeListener.getBestRoutingPlan(); return PortableRoutingPlanFactory.fromRoutingPlan(routingPlan); } @Autowired  WebSocketController(
            RouteListener routeListener,
            RegionService regionService,
            LocationService locationService,
            VehicleService vehicleService,
            DemoService demoService,
            ApplicationEventPublisher eventPublisher);   }