@Test public void testThatWhenEditorMenuIsPresentThenAddEditorMenuFindsFragmentByTag() { givenThatEditorMenuIsPresent(); menuSwitcher.addEditorMenu(); verify(fragmentManager, times(2)).findFragmentByTag(WorldEditorMenuFragment.TAG); }
public WorldEditorMenu addEditorMenu() { if (editorMenuIsPresent()) { return Classes.from(fragmentManager.findFragmentByTag(WorldEditorMenuFragment.TAG)); } else { WorldEditorMenu worldEditorMenu = new WorldEditorMenuFragment(); fragmentManager.beginTransaction().replace(R.id.menu_container, worldEditorMenu.getFragment(), WorldEditorMenuFragment.TAG).commit(); return worldEditorMenu; } }
MenuSwitcher { public WorldEditorMenu addEditorMenu() { if (editorMenuIsPresent()) { return Classes.from(fragmentManager.findFragmentByTag(WorldEditorMenuFragment.TAG)); } else { WorldEditorMenu worldEditorMenu = new WorldEditorMenuFragment(); fragmentManager.beginTransaction().replace(R.id.menu_container, worldEditorMenu.getFragment(), WorldEditorMenuFragment.TAG).commit(); return worldEditorMenu; } } }
MenuSwitcher { public WorldEditorMenu addEditorMenu() { if (editorMenuIsPresent()) { return Classes.from(fragmentManager.findFragmentByTag(WorldEditorMenuFragment.TAG)); } else { WorldEditorMenu worldEditorMenu = new WorldEditorMenuFragment(); fragmentManager.beginTransaction().replace(R.id.menu_container, worldEditorMenu.getFragment(), WorldEditorMenuFragment.TAG).commit(); return worldEditorMenu; } } @VisibleForTesting protected  MenuSwitcher(FragmentManager fragmentManager); }
MenuSwitcher { public WorldEditorMenu addEditorMenu() { if (editorMenuIsPresent()) { return Classes.from(fragmentManager.findFragmentByTag(WorldEditorMenuFragment.TAG)); } else { WorldEditorMenu worldEditorMenu = new WorldEditorMenuFragment(); fragmentManager.beginTransaction().replace(R.id.menu_container, worldEditorMenu.getFragment(), WorldEditorMenuFragment.TAG).commit(); return worldEditorMenu; } } @VisibleForTesting protected  MenuSwitcher(FragmentManager fragmentManager); static MenuSwitcher newInstance(); MainMenu addMainMenu(); WorldEditorMenu addEditorMenu(); ImageLoader addImageLoader(); }
MenuSwitcher { public WorldEditorMenu addEditorMenu() { if (editorMenuIsPresent()) { return Classes.from(fragmentManager.findFragmentByTag(WorldEditorMenuFragment.TAG)); } else { WorldEditorMenu worldEditorMenu = new WorldEditorMenuFragment(); fragmentManager.beginTransaction().replace(R.id.menu_container, worldEditorMenu.getFragment(), WorldEditorMenuFragment.TAG).commit(); return worldEditorMenu; } } @VisibleForTesting protected  MenuSwitcher(FragmentManager fragmentManager); static MenuSwitcher newInstance(); MainMenu addMainMenu(); WorldEditorMenu addEditorMenu(); ImageLoader addImageLoader();  }