Navigator { public void openBrushSelectionDialog() { if (!brushOptionsDialog.isAdded()) { brushOptionsDialog.show(fragmentManager, BrushOptionsDialog.TAG); } } Navigator(FragmentManager fragmentManager, BrushOptionsDialog brushOptionsDialog, FlowerOptionsDialog flowerOptionsDialog); static Navigator newInstance(); void openBrushSelectionDialog(); void openFlowerSelectionDialog();  }
@Test public void testThatWhenOpenBrushSelectionDialogIfDialogNotAlreadyAddedThenShowWillBeCalled() { navigator.openBrushSelectionDialog(); verify(brushOptionsDialog).show(fragmentManager, BrushOptionsDialog.TAG); }
@Test public void testThatWhenOpenBrushSelectionDialogIfDialogAlreadyIsNotAddedThenShowWillNotBeCalled() { givenThatBrushOptionsDialogIsAdded(); navigator.openBrushSelectionDialog(); verify(brushOptionsDialog, never()).show(any(FragmentManager.class), anyString()); }