### Question:
RouteProcessorThreadListener implements RouteProcessorBackgroundThread.Listener { @Override public void onMilestoneTrigger(List<Milestone> triggeredMilestones, RouteProgress routeProgress) { for (Milestone milestone : triggeredMilestones) { String instruction = buildInstructionString(routeProgress, milestone); eventDispatcher.onMilestoneEvent(routeProgress, instruction, milestone); } } RouteProcessorThreadListener(NavigationEventDispatcher eventDispatcher, RouteFetcher routeFetcher,
                               NavigationNotificationProvider notificationProvider); @Override void onNewRouteProgress(Location location, RouteProgress routeProgress); @Override void onMilestoneTrigger(List<Milestone> triggeredMilestones, RouteProgress routeProgress); @Override void onUserOffRoute(Location location, boolean userOffRoute); @Override void onCheckFasterRoute(Location location, RouteProgress routeProgress, boolean checkFasterRoute);  }### Answer:
@Test public void onMilestoneTrigger_eventDispatcherSendsMilestone() { List<Milestone> milestones = new ArrayList<>(); StepMilestone stepMilestone = new StepMilestone.Builder().build(); milestones.add(stepMilestone); NavigationEventDispatcher eventDispatcher = mock(NavigationEventDispatcher.class); RouteProcessorThreadListener listener = buildListener(eventDispatcher); RouteProgress routeProgress = mock(RouteProgress.class); listener.onMilestoneTrigger(milestones, routeProgress); verify(eventDispatcher).onMilestoneEvent(eq(routeProgress), anyString(), eq(stepMilestone)); }
@Test public void onMilestoneTrigger_correctInstructionIsBuilt() { String customInstruction = "Custom instruction!"; Instruction instruction = buildCustomInstruction(customInstruction); List<Milestone> milestones = new ArrayList<>(); Milestone stepMilestone = new StepMilestone.Builder().setInstruction(instruction).build(); milestones.add(stepMilestone); NavigationEventDispatcher eventDispatcher = mock(NavigationEventDispatcher.class); RouteProcessorThreadListener listener = buildListener(eventDispatcher); RouteProgress routeProgress = mock(RouteProgress.class); listener.onMilestoneTrigger(milestones, routeProgress); verify(eventDispatcher).onMilestoneEvent(eq(routeProgress), eq(customInstruction), eq(stepMilestone)); }