HomeContainerPresenter implements Presenter { @VisibleForTesting public void loadMainHomeContent() { view.getLifecycleEvent() .filter(event -> event.equals(View.LifecycleEvent.CREATE)) .flatMap(__ -> view.isChipChecked()) .doOnNext(checked -> { switch (checked) { case GAMES: homeContainerNavigator.loadGamesHomeContent(); break; case APPS: homeContainerNavigator.loadAppsHomeContent(); break; default: homeContainerNavigator.loadMainHomeContent(); break; } }) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(__ -> { }, err -> { throw new OnErrorNotImplementedException(err); }); } HomeContainerPresenter(HomeContainerView view, Scheduler viewScheduler,
      AptoideAccountManager accountManager, HomeContainerNavigator homeContainerNavigator,
      HomeNavigator homeNavigator, HomeAnalytics homeAnalytics, Home home,
      ChipManager chipManager); @Override void present(); @VisibleForTesting void loadMainHomeContent(); @VisibleForTesting void loadUserImage(); @VisibleForTesting void handleUserImageClick(); @VisibleForTesting void handlePromotionsClick(); @VisibleForTesting void checkForPromotionApps(); @VisibleForTesting void handleClickOnPromotionsDialogContinue(); @VisibleForTesting void handleClickOnPromotionsDialogCancel(); @VisibleForTesting void handleLoggedInAcceptTermsAndConditions(); @VisibleForTesting void handleTermsAndConditionsContinueClicked(); @VisibleForTesting void handleTermsAndConditionsLogOutClicked(); @VisibleForTesting void handleClickOnTermsAndConditions(); @VisibleForTesting void handleClickOnPrivacyPolicy(); @VisibleForTesting void handleClickOnGamesChip(); @VisibleForTesting void handleClickOnAppsChip();  }
@Test public void gamesChipChecked_loadHomeMainContentTest() { when(view.isChipChecked()).thenReturn(Observable.just(HomeContainerFragment.ChipsEvents.GAMES)); presenter.loadMainHomeContent(); lifecycleEvent.onNext(View.LifecycleEvent.CREATE); verify(homeContainerNavigator).loadGamesHomeContent(); }
@Test public void noChipsChecked_loadHomeMainContentTest() { when(view.isChipChecked()).thenReturn(Observable.just(HomeContainerFragment.ChipsEvents.HOME)); presenter.loadMainHomeContent(); lifecycleEvent.onNext(View.LifecycleEvent.CREATE); verify(homeContainerNavigator).loadMainHomeContent(); }
@Test public void appsChipChecked_loadHomeMainContentTest() { when(view.isChipChecked()).thenReturn(Observable.just(HomeContainerFragment.ChipsEvents.APPS)); presenter.loadMainHomeContent(); lifecycleEvent.onNext(View.LifecycleEvent.CREATE); verify(homeContainerNavigator).loadAppsHomeContent(); }