MoreBundlePresenter implements Presenter { @VisibleForTesting public void handleMoreClick() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> view.moreClicked() .doOnNext(homeMoreClick -> { ChipManager.Chip chip = chipManager.getCurrentChip(); homeAnalytics.sendTapOnMoreInteractEvent(homeMoreClick.getBundlePosition(), homeMoreClick.getBundle() .getTag(), homeMoreClick.getBundle() .getContent() .size(), chip != null ? chip.getName() : null); if (chip != null) { homeAnalytics.sendChipTapOnMore(homeMoreClick.getBundle() .getTag(), chip.getName()); } }) .observeOn(viewScheduler) .doOnNext(homeNavigator::navigateWithAction) .retry()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(homeClick -> { }, throwable -> { throw new OnErrorNotImplementedException(throwable); }); } MoreBundlePresenter(MoreBundleView view, MoreBundleManager moreBundleManager,
      Scheduler viewScheduler, CrashReport crashReporter, HomeNavigator homeNavigator,
      AdMapper adMapper, BundleEvent bundleEvent, HomeAnalytics homeAnalytics,
      ChipManager chipManager); @Override void present(); @VisibleForTesting void onCreateSetupToolbar(); @VisibleForTesting void onCreateLoadBundles(); @VisibleForTesting void handleAppClick(); @VisibleForTesting void handleAdClick(); @VisibleForTesting void handleMoreClick(); @VisibleForTesting void handleBundleScrolledRight(); @VisibleForTesting void handleBottomReached(); @VisibleForTesting void handlePullToRefresh(); @VisibleForTesting void handleRetryClick();  }
@Test public void moreClicked_NavigateToActionView() { HomeEvent click = new HomeEvent(localTopAppsBundle, 0, HomeEvent.Type.MORE); presenter.handleMoreClick(); lifecycleEvent.onNext(View.LifecycleEvent.CREATE); moreClickEvent.onNext(click); verify(homeAnalytics).sendTapOnMoreInteractEvent(0, localTopAppsBundle.getTag(), localTopAppsBundle.getContent() .size(), null); verify(homeNavigator).navigateWithAction(click); }
@Test public void moreClicked_GamesChipAnalytics() { HomeEvent click = new HomeEvent(localTopAppsBundle, 0, HomeEvent.Type.MORE); when(chipManager.getCurrentChip()).thenReturn(ChipManager.Chip.GAMES); presenter.handleMoreClick(); lifecycleEvent.onNext(View.LifecycleEvent.CREATE); moreClickEvent.onNext(click); verify(homeAnalytics).sendChipTapOnMore(localTopAppsBundle.getTag(), ChipManager.Chip.GAMES.getName()); }
@Test public void moreClicked_AppsChipAnalytics() { HomeEvent click = new HomeEvent(localTopAppsBundle, 0, HomeEvent.Type.MORE); when(chipManager.getCurrentChip()).thenReturn(ChipManager.Chip.APPS); presenter.handleMoreClick(); lifecycleEvent.onNext(View.LifecycleEvent.CREATE); moreClickEvent.onNext(click); verify(homeAnalytics).sendChipTapOnMore(localTopAppsBundle.getTag(), ChipManager.Chip.APPS.getName()); }