use of com.mapbox.services.android.navigation.v5.navigation.NavigationRoute in project mapbox-navigation-android by mapbox.
the class NavigationRouteTest method addRouteOptionsIncludedInRequest.
@Test
public void addRouteOptionsIncludedInRequest() throws Exception {
List<Point> coordinates = new ArrayList<>();
coordinates.add(Point.fromLngLat(1.0, 2.0));
coordinates.add(Point.fromLngLat(1.0, 5.0));
RouteOptions routeOptions = RouteOptions.builder().accessToken(ACCESS_TOKEN).baseUrl("https://api-directions-traf.com").requestUuid("XYZ_UUID").alternatives(true).language(Locale.US.getLanguage()).profile(DirectionsCriteria.PROFILE_WALKING).coordinates(coordinates).voiceUnits(DirectionsCriteria.METRIC).user("example_user").build();
NavigationRoute navigationRoute = NavigationRoute.builder().origin(coordinates.get(0)).destination(coordinates.get(1)).routeOptions(routeOptions).build();
String request = navigationRoute.getCall().request().url().toString();
assertThat(request, containsString("https://api-directions-traf.com"));
assertThat(request, containsString("alternatives=true"));
assertThat(request, containsString(ACCESS_TOKEN));
assertThat(request, containsString("voice_units=metric"));
assertThat(request, containsString("example_user"));
assertThat(request, containsString("language=en"));
assertThat(request, containsString("walking"));
}
use of com.mapbox.services.android.navigation.v5.navigation.NavigationRoute in project mapbox-navigation-android by mapbox.
the class NavigationRouteTest method addingPointAndBearingKeepsCorrectOrder.
@Test
public void addingPointAndBearingKeepsCorrectOrder() throws Exception {
NavigationRoute navigationRoute = NavigationRoute.builder().accessToken(ACCESS_TOKEN).origin(Point.fromLngLat(1.0, 2.0), 90d, 90d).addBearing(2.0, 3.0).destination(Point.fromLngLat(1.0, 5.0)).build();
String requestUrl = navigationRoute.getCall().request().url().toString();
assertThat(requestUrl, containsString("bearings=90%2C90%3B2%2C3%3B"));
}
Aggregations