### Question:
NavigationViewEventDispatcher { void onInstructionListVisibilityChanged(boolean shown) { if (instructionListListener != null) { instructionListListener.onInstructionListVisibilityChanged(shown); } }    }### Answer:
@Test public void onInstructionListShown_listenerReturnsTrue() { InstructionListListener instructionListListener = mock(InstructionListListener.class); NavigationViewEventDispatcher eventDispatcher = buildViewEventDispatcher(instructionListListener); eventDispatcher.onInstructionListVisibilityChanged(true); verify(instructionListListener, times(1)).onInstructionListVisibilityChanged(true); }
@Test public void onInstructionListHidden_listenerReturnsFalse() { InstructionListListener instructionListListener = mock(InstructionListListener.class); NavigationViewEventDispatcher eventDispatcher = buildViewEventDispatcher(instructionListListener); eventDispatcher.onInstructionListVisibilityChanged(false); verify(instructionListListener, times(1)).onInstructionListVisibilityChanged(false); }
@Test public void onInstructionListShown_listenerReturnsTrue() { InstructionListListener instructionListListener = mock(InstructionListListener.class); NavigationViewEventDispatcher eventDispatcher = buildDispatcher(instructionListListener); eventDispatcher.onInstructionListVisibilityChanged(true); verify(instructionListListener, times(1)).onInstructionListVisibilityChanged(true); }
@Test public void onInstructionListHidden_listenerReturnsFalse() { InstructionListListener instructionListListener = mock(InstructionListListener.class); NavigationViewEventDispatcher eventDispatcher = buildDispatcher(instructionListListener); eventDispatcher.onInstructionListVisibilityChanged(false); verify(instructionListListener, times(1)).onInstructionListVisibilityChanged(false); }