### Question:
BottomTabsController extends ParentController implements AHBottomNavigation.OnTabSelectedListener, TabSelector { @Override public boolean onTabSelected(int index, boolean wasSelected) { eventEmitter.emitBottomTabSelected(bottomTabs.getCurrentItem(), index); if (wasSelected) return false; selectTab(index); return false; } BottomTabsController(Activity activity, List<ViewController> tabs, ChildControllersRegistry childRegistry, EventEmitter eventEmitter, ImageLoader imageLoader, String id, Options initialOptions, Presenter presenter, BottomTabsAttacher tabsAttacher, BottomTabsPresenter bottomTabsPresenter, BottomTabPresenter bottomTabPresenter); @Override void setDefaultOptions(Options defaultOptions); @Override void applyOptions(Options options); @Override void mergeOptions(Options options); @Override void applyChildOptions(Options options, Component child); @Override void mergeChildOptions(Options options, ViewController childController, Component child); @Override boolean handleBack(CommandListener listener); @Override void sendOnNavigationButtonPressed(String buttonId); @Override boolean onTabSelected(int index, boolean wasSelected); int getSelectedIndex(); @NonNull @Override Collection<ViewController> getChildControllers(); @Override void destroy(); @Override void selectTab(final int newIndex); @RestrictTo(RestrictTo.Scope.TESTS) BottomTabs getBottomTabs();  }### Answer:
@Test public void onTabSelected() { uut.ensureViewIsCreated(); assertThat(uut.getSelectedIndex()).isZero(); assertThat(((ViewController) ((List) uut.getChildControllers()).get(0)).getView().getVisibility()).isEqualTo(View.VISIBLE); uut.onTabSelected(3, false); assertThat(uut.getSelectedIndex()).isEqualTo(3); assertThat(((ViewController) ((List) uut.getChildControllers()).get(0)).getView().getVisibility()).isEqualTo(View.INVISIBLE); assertThat(((ViewController) ((List) uut.getChildControllers()).get(3)).getView().getVisibility()).isEqualTo(View.VISIBLE); verify(eventEmitter, times(1)).emitBottomTabSelected(0, 3); }