### Question:
NavigationViewEventDispatcher { void onCancelNavigation() { if (navigationListener != null) { navigationListener.onCancelNavigation(); } }    }### Answer:
@Test public void onNavigationListenerNotSet_cancelListenerIsNotCalled() throws Exception { NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); NavigationListener navigationListener = mock(NavigationListener.class); eventDispatcher.onCancelNavigation(); verify(navigationListener, times(0)).onCancelNavigation(); }
@Test public void onNavigationListenerNotSet_cancelListenerIsNotCalled() { NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher(); NavigationListener navigationListener = mock(NavigationListener.class); eventDispatcher.onCancelNavigation(); verify(navigationListener, times(0)).onCancelNavigation(); }