EditorialListPresenter implements Presenter { @VisibleForTesting public void handleBottomReached() { view.getLifecycleEvent() .filter(lifecycleEvent -> lifecycleEvent.equals(View.LifecycleEvent.CREATE)) .flatMap(created -> view.reachesBottom() .filter(__ -> editorialListManager.hasMore()) .observeOn(viewScheduler) .doOnNext(bottomReached -> view.showLoadMore()) .flatMap(bottomReach -> loadEditorialAndReactions(true, false)) .retry()) .compose(view.bindUntilEvent(View.LifecycleEvent.DESTROY)) .subscribe(bundles -> { }, throwable -> crashReporter.log(throwable)); } EditorialListPresenter(EditorialListView editorialListView,
      EditorialListManager editorialListManager, AptoideAccountManager accountManager,
      EditorialListNavigator editorialListNavigator, EditorialListAnalytics editorialListAnalytics,
      CrashReport crashReporter, Scheduler viewScheduler,
      UserFeedbackAnalytics userFeedbackAnalytics); @Override void present(); @VisibleForTesting void onCreateLoadViewModel(); @VisibleForTesting void loadUserImage(); @VisibleForTesting void handleEditorialCardClick(); @VisibleForTesting void handlePullToRefresh(); @VisibleForTesting void handleRetryClick(); @VisibleForTesting void handleImpressions(); @VisibleForTesting void handleBottomReached(); @VisibleForTesting void handleUserImageClick(); @VisibleForTesting void handleReactionButtonClick(); @VisibleForTesting void handleUserReaction(); @VisibleForTesting void handleSnackLogInClick();  }
@Test public void handleBottomReachedTest() { presenter.handleBottomReached(); when(editorialListManager.loadEditorialListViewModel(true, false)).thenReturn( Single.just(successEditorialViewModel)); when(editorialListManager.hasMore()).thenReturn(true); lifecycleEvent.onNext(View.LifecycleEvent.CREATE); bottomReachedEvent.onNext(new Object()); verify(view).showLoadMore(); verify(editorialListManager).loadEditorialListViewModel(true, false); verify(view).hideLoadMore(); verify(view).hideLoading(); verify(view).populateView(successEditorialViewModel.getCurationCards()); }