use of com.mapbox.services.android.navigation.v5.route.FasterRoute in project mapbox-navigation-android by mapbox.
the class FasterRouteDetectorTest method onFasterRouteResponse_isFasterRouteIsTrue.
@Test
public void onFasterRouteResponse_isFasterRouteIsTrue() throws Exception {
FasterRoute fasterRouteEngine = navigation.getFasterRouteEngine();
// Create current progress
RouteProgress currentProgress = obtainDefaultRouteProgress();
DirectionsRoute longerRoute = currentProgress.directionsRoute().toBuilder().duration(// Current route duration is very long
10000000d).build();
currentProgress = currentProgress.toBuilder().directionsRoute(longerRoute).build();
// Create new direction response
DirectionsResponse response = obtainADirectionsResponse();
boolean isFasterRoute = fasterRouteEngine.isFasterRoute(response, currentProgress);
assertTrue(isFasterRoute);
}
use of com.mapbox.services.android.navigation.v5.route.FasterRoute in project mapbox-navigation-android by mapbox.
the class FasterRouteDetectorTest method onNullLocationPassed_shouldCheckFasterRouteIsFalse.
@Test
public void onNullLocationPassed_shouldCheckFasterRouteIsFalse() throws Exception {
FasterRoute fasterRouteEngine = navigation.getFasterRouteEngine();
boolean checkFasterRoute = fasterRouteEngine.shouldCheckFasterRoute(null, obtainDefaultRouteProgress());
assertFalse(checkFasterRoute);
}
use of com.mapbox.services.android.navigation.v5.route.FasterRoute in project mapbox-navigation-android by mapbox.
the class FasterRouteDetectorTest method addFasterRouteEngine_didGetAdded.
@Test
public void addFasterRouteEngine_didGetAdded() throws Exception {
FasterRoute fasterRouteEngine = mock(FasterRoute.class);
navigation.setFasterRouteEngine(fasterRouteEngine);
assertEquals(navigation.getFasterRouteEngine(), fasterRouteEngine);
}
use of com.mapbox.services.android.navigation.v5.route.FasterRoute in project mapbox-navigation-android by mapbox.
the class FasterRouteDetectorTest method onSlowerRouteResponse_isFasterRouteIsFalse.
@Test
public void onSlowerRouteResponse_isFasterRouteIsFalse() throws Exception {
FasterRoute fasterRouteEngine = navigation.getFasterRouteEngine();
// Create current progress
RouteProgress currentProgress = obtainDefaultRouteProgress();
DirectionsRoute longerRoute = currentProgress.directionsRoute().toBuilder().duration(// Current route duration is very short
1000d).build();
currentProgress = currentProgress.toBuilder().directionsRoute(longerRoute).build();
// Create new direction response
DirectionsResponse response = obtainADirectionsResponse();
boolean isFasterRoute = fasterRouteEngine.isFasterRoute(response, currentProgress);
assertFalse(isFasterRoute);
}
use of com.mapbox.services.android.navigation.v5.route.FasterRoute in project mapbox-navigation-android by mapbox.
the class FasterRouteDetectorTest method onNullRouteProgressPassed_shouldCheckFasterRouteIsFalse.
@Test
public void onNullRouteProgressPassed_shouldCheckFasterRouteIsFalse() throws Exception {
FasterRoute fasterRouteEngine = navigation.getFasterRouteEngine();
boolean checkFasterRoute = fasterRouteEngine.shouldCheckFasterRoute(mock(Location.class), null);
assertFalse(checkFasterRoute);
}
Aggregations