### Question:
RouteProcessorThreadListener implements RouteProcessorBackgroundThread.Listener { @Override public void onCheckFasterRoute(Location location, RouteProgress routeProgress, boolean checkFasterRoute) { if (checkFasterRoute) { routeFetcher.findRouteFromRouteProgress(location, routeProgress); } } 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 onCheckFasterRouteTrue_eventDispatcherSendsEvent() { RouteFetcher routeFetcher = mock(RouteFetcher.class); RouteProcessorThreadListener listener = buildListener(routeFetcher); Location location = mock(Location.class); RouteProgress routeProgress = mock(RouteProgress.class); listener.onCheckFasterRoute(location, routeProgress, true); verify(routeFetcher).findRouteFromRouteProgress(eq(location), eq(routeProgress)); }
@Test public void onCheckFasterRouteFalse_eventDispatcherDoesNotSendEvent() { NavigationEventDispatcher dispatcher = mock(NavigationEventDispatcher.class); RouteProcessorThreadListener listener = buildListener(dispatcher); listener.onCheckFasterRoute(mock(Location.class), mock(RouteProgress.class), false); verifyZeroInteractions(dispatcher); }