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