### Question:
NavigationViewEventDispatcher { BannerInstructions onBannerDisplay(BannerInstructions instructions) { if (bannerInstructionsListener != null) { return bannerInstructionsListener.willDisplay(instructions); } return instructions; }    }### Answer:
@Test public void onNewBannerInstruction_instructionListenerIsCalled() { BannerInstructions modifiedInstructions = mock(BannerInstructions.class); BannerInstructions originalInstructions = mock(BannerInstructions.class); BannerInstructionsListener bannerInstructionsListener = mock(BannerInstructionsListener.class); when(bannerInstructionsListener.willDisplay(originalInstructions)).thenReturn(modifiedInstructions); NavigationViewEventDispatcher eventDispatcher = buildViewEventDispatcher(bannerInstructionsListener); eventDispatcher.onBannerDisplay(originalInstructions); verify(bannerInstructionsListener).willDisplay(originalInstructions); }
@Test public void onNewBannerInstruction_instructionListenerIsCalled() { BannerInstructions modifiedInstructions = mock(BannerInstructions.class); BannerInstructions originalInstructions = mock(BannerInstructions.class); BannerInstructionsListener bannerInstructionsListener = mock(BannerInstructionsListener.class); when(bannerInstructionsListener.willDisplay(originalInstructions)).thenReturn(modifiedInstructions); NavigationViewEventDispatcher eventDispatcher = buildDispatcher(bannerInstructionsListener); eventDispatcher.onBannerDisplay(originalInstructions); verify(bannerInstructionsListener).willDisplay(originalInstructions); }