} public class GoogleRouteDTO { List<GoogleLegDTO> legs; } public class GoogleLegDTO { List<GoogleStepDTO> steps; } public class GoogleStepDTO { GoogleOverviewPolyLineDTO overviewPolyline; } public class GoogleOverviewPolyLineDTO { String points; }
List<Leg> legs; public List<LatLng> getFirstLegLatLngs() {} public List<LatLng> getOtherLegLatLngs() {} } public class Leg { private List<LatLng> latlngs; public List<LatLng> getLatLngs() {} }
DriverDirectionView { MapRenderer mapRenderer; GoogleApi gooogleApi; public void displayRoute(LatLng currentLatLng, LatLng destinationLatLng, List<LatLng> waypoints) { final String query = constructQuery(currentLatLng, destinationLatLng, waypoints); final GoogleDirectionsResponseDTO response = googleApi.getDirections(query); final Route route = RouteMapper.toRoute(response); // displays the line in purple mapRenderer.addPurpleLine(route.getFirstLegLatLngs()); // displays the line in grey mapRenderer.addGrayLine(route.getOtherLegLatLngs()); } }
GoogleApi gooogleApi; public void displayRoute(LatLng currentLatLng, LatLng destinationLatLng, List<LatLng> waypoints) { final String query = constructQuery(currentLatLng, destinationLatLng, waypoints); final GoogleDirectionsResponseDTO response = googleApi.getDirections(query); final Route route = RouteMapper.toRoute(response); // displays the line in purple mapRenderer.addPurpleLine(route.getFirstLegLatLngs()); // displays the line in grey mapRenderer.addGrayLine(route.getOtherLegLatLngs()); } }
public void displayRoute(LatLng currentLatLng, LatLng destinationLatLng, List<LatLng> waypoints) { final Route route = directionsService.getDirections(currentLatLng, destinationLatLng, waypoints); // displays the line in purple mapRenderer.addPurpleLine(route.getFirstLegLatLngs()); // displays the line in grey mapRenderer.addGrayLine(route.getOtherLegLatLngs()); } }
returnsSingleLeggedRouteForSingleGoogleLeggedRoute() { // given GoogleResponseDTOBuilder responseBuilder = new GoogleResponseDTOBuilder(); // Build a response with a single route with single leg // and with a single step // when Route route = RouteMapper.toRoute(responseBuilder.build()); // then // Assert route object is constructed properly } … }
returnsEmptyListWhenGetOtherLegsWithSingleLeg() { // given RouteBuilder routeBuilder = new RouteBuilder(); // Construct a single legged route // when Route route = routeBuilder.build(); // then assertThat(route.getOtherLegs()).isEmpty(); // more assertions } … }
directionsService; public void displayRoute(LatLng currentLatLng, LatLng destinationLatLng, List<LatLng> waypoints) { final Route route = directionsService.getDirections(currentLatLng, destinationLatLng, waypoints); // displays the line in purple mapRenderer.addPurpleLine(route.getFirstLegLatLngs()); // displays the line in grey mapRenderer.addGrayLine(route.getOtherLegLatLngs()); } }
public List<LatLng> getFirstLegLatLngs() {} public List<LatLng> getOtherLegLatLngs() {} } public class Leg { private List<LatLng> latlngs; public List<LatLng> getLatLngs() {} }
public List<LatLng> getFirstLegLatLngs() {} public List<LatLng> getOtherLegLatLngs() {} public List<LatLng> getLatLngs() {} } public class Leg { private List<LatLng> latlngs; public List<LatLng> getLatLngs() {} }
public void displayRoute(LatLng currentLatLng, LatLng destinationLatLng, List<LatLng> waypoints) { final Route route = directionsService.getDirections(currentLatLng, destinationLatLng, waypoints); // displays the line in grey mapRenderer.addGrayLine(route.getLatLngs()); } }