StatisticsPresenter implements StatisticsContract.Presenter { @Override public void start() { loadStatistics(); } StatisticsPresenter(
            @NonNull UseCaseHandler useCaseHandler,
            @NonNull StatisticsContract.View statisticsView,
            @NonNull GetTasks getTasks); @Override void start();  }
@Test public void loadEmptyTasksFromRepository_CallViewToDisplay() { TASKS.clear(); mStatisticsPresenter.start(); verify(mStatisticsView).setProgressIndicator(true); verify(mTasksRepository).getTasks(mLoadTasksCallbackCaptor.capture()); mLoadTasksCallbackCaptor.getValue().onTasksLoaded(TASKS); verify(mStatisticsView).setProgressIndicator(false); verify(mStatisticsView).showStatistics(0, 0); }
@Test public void loadNonEmptyTasksFromRepository_CallViewToDisplay() { mStatisticsPresenter.start(); verify(mStatisticsView).setProgressIndicator(true); verify(mTasksRepository).getTasks(mLoadTasksCallbackCaptor.capture()); mLoadTasksCallbackCaptor.getValue().onTasksLoaded(TASKS); verify(mStatisticsView).setProgressIndicator(false); verify(mStatisticsView).showStatistics(1, 2); }
@Test public void loadStatisticsWhenTasksAreUnavailable_CallErrorToDisplay() { mStatisticsPresenter.start(); verify(mTasksRepository).getTasks(mLoadTasksCallbackCaptor.capture()); mLoadTasksCallbackCaptor.getValue().onDataNotAvailable(); verify(mStatisticsView).showLoadingStatisticsError(); }