WebSocketController { @SubscribeMapping("/serverInfo") ServerInfo subscribeToServerInfoTopic() { BoundingBox boundingBox = regionService.boundingBox(); List<PortableCoordinates> portableBoundingBox = Arrays.asList( PortableCoordinates.fromCoordinates(boundingBox.getSouthWest()), PortableCoordinates.fromCoordinates(boundingBox.getNorthEast())); List<RoutingProblemInfo> demos = demoService.demos().stream() .map(routingProblem -> new RoutingProblemInfo( routingProblem.name(), routingProblem.visits().size())) .collect(toList()); return new ServerInfo(portableBoundingBox, regionService.countryCodes(), demos); } @Autowired  WebSocketController(
            RouteListener routeListener,
            RegionService regionService,
            LocationService locationService,
            VehicleService vehicleService,
            DemoService demoService,
            ApplicationEventPublisher eventPublisher);   }
@Test void subscribeToServerInfo() { List<String> countryCodes = Arrays.asList("XY", "WZ"); when(regionService.countryCodes()).thenReturn(countryCodes); Coordinates southWest = Coordinates.valueOf(-1.0, -2.0); Coordinates northEast = Coordinates.valueOf(1.0, 2.0); BoundingBox boundingBox = new BoundingBox(southWest, northEast); when(regionService.boundingBox()).thenReturn(boundingBox); Location depot = new Location(1, Coordinates.valueOf(1.0, 7), "Depot"); List<Location> visits = Arrays.asList(new Location(2, Coordinates.valueOf(2.0, 9), "Visit")); List<Vehicle> vehicles = Arrays.asList(VehicleFactory.testVehicle(1)); String demoName = "Testing problem"; RoutingProblem routingProblem = new RoutingProblem(demoName, vehicles, depot, visits); when(demoService.demos()).thenReturn(Arrays.asList(routingProblem)); ServerInfo serverInfo = webSocketController.subscribeToServerInfoTopic(); assertThat(serverInfo.getCountryCodes()).isEqualTo(countryCodes); assertThat(serverInfo.getBoundingBox()).containsExactly( PortableCoordinates.fromCoordinates(southWest), PortableCoordinates.fromCoordinates(northEast)); List<RoutingProblemInfo> demos = serverInfo.getDemos(); assertThat(demos).hasSize(1); RoutingProblemInfo demo = demos.get(0); assertThat(demo.getName()).isEqualTo(demoName); assertThat(demo.getVisits()).isEqualTo(visits.size()); }