use of com.mapbox.services.android.navigation.v5.milestone.Milestone in project mapbox-navigation-android by mapbox.
the class MapboxNavigationTest method removeMilestone_milestoneDoesNotExist.
@Test
public void removeMilestone_milestoneDoesNotExist() throws Exception {
MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build();
MapboxNavigation navigationWithOptions = new MapboxNavigation(mock(Context.class), ACCESS_TOKEN, options, mock(NavigationTelemetry.class), mock(LocationEngine.class));
Milestone milestone = new StepMilestone.Builder().build();
navigationWithOptions.addMilestone(new StepMilestone.Builder().build());
navigationWithOptions.removeMilestone(milestone);
assertEquals(1, navigationWithOptions.getMilestones().size());
}
use of com.mapbox.services.android.navigation.v5.milestone.Milestone in project mapbox-navigation-android by mapbox.
the class MapboxNavigationTest method addMilestone_milestoneDidGetAdded.
@Test
public void addMilestone_milestoneDidGetAdded() throws Exception {
Milestone milestone = new StepMilestone.Builder().build();
navigation.addMilestone(milestone);
assertTrue(navigation.getMilestones().contains(milestone));
}
use of com.mapbox.services.android.navigation.v5.milestone.Milestone in project mapbox-navigation-android by mapbox.
the class NavigationHelperTest method checkMilestones_onlyTriggeredMilestonesGetReturned.
@Test
public void checkMilestones_onlyTriggeredMilestonesGetReturned() throws Exception {
RouteProgress routeProgress = routeProgressBuilder.legIndex(0).stepIndex(0).build();
MapboxNavigationOptions options = MapboxNavigationOptions.builder().defaultMilestonesEnabled(false).build();
MapboxNavigation mapboxNavigation = new MapboxNavigation(mock(Context.class), ACCESS_TOKEN, options, mock(NavigationTelemetry.class), mock(LocationEngine.class));
mapboxNavigation.addMilestone(new StepMilestone.Builder().setTrigger(Trigger.eq(TriggerProperty.STEP_INDEX, 0)).setIdentifier(1001).build());
mapboxNavigation.addMilestone(new StepMilestone.Builder().setTrigger(Trigger.eq(TriggerProperty.STEP_INDEX, 4)).setIdentifier(1002).build());
List<Milestone> triggeredMilestones = checkMilestones(routeProgress, routeProgress, mapboxNavigation);
assertEquals(1, triggeredMilestones.size());
assertEquals(1001, triggeredMilestones.get(0).getIdentifier());
assertNotSame(1002, triggeredMilestones.get(0).getIdentifier());
}
Aggregations