### Question:
RouteProcessorThreadListener implements RouteProcessorBackgroundThread.Listener { @Override public void onUserOffRoute(Location location, boolean userOffRoute) { if (userOffRoute) { eventDispatcher.onUserOffRoute(location); } } 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 onUserOffRouteTrue_eventDispatcherSendsEvent() { NavigationEventDispatcher dispatcher = mock(NavigationEventDispatcher.class); RouteProcessorThreadListener listener = buildListener(dispatcher); Location location = mock(Location.class); listener.onUserOffRoute(location, true); verify(dispatcher).onUserOffRoute(eq(location)); }
@Test public void onUserOffRouteFalse_eventDispatcherDoesNotSendEvent() { NavigationEventDispatcher dispatcher = mock(NavigationEventDispatcher.class); RouteProcessorThreadListener listener = buildListener(dispatcher); listener.onUserOffRoute(mock(Location.class), false); verifyZeroInteractions(dispatcher); }