UserDetailsPresenter implements Presenter<UserDetailsView> { public void loadRepositories(String username) { userDetailsView.showProgressIndicator(); loadUserDetailsUseCase.execute(new LoadRepositoriesSubscriber(), username); } @Inject  UserDetailsPresenter(@Named("userDetails") UseCase loadUserDetailsUseCase); @Override void attachView(UserDetailsView userDetailsView); void loadRepositories(String username); @Override void detachView(); @Override void destroy(boolean unsubscribe);  }
@Test public void loadRepositoriesShouldCallShowRepositoriesWhenReceivedResults() { userDetailsPresenter.loadRepositories(MockFactory.TEST_USERNAME); verify(userDetailsView).showRepositories(anyList()); }
@Test public void loadRepositoriesShouldShowProgressIndicator() { userDetailsPresenter.loadRepositories(MockFactory.TEST_USERNAME); verify(userDetailsView).showProgressIndicator(); }
@Test public void loadRepositoriesShouldShowMessageIfEmptyResponse() { userDetailsPresenter.loadRepositories(MockFactory.TEST_USERNAME_NO_RESULTS); verify(userDetailsView).showMessage("The user does not have any public repositories"); }
@Test public void loadRepositoriesShouldShowMessageIfError() { userDetailsPresenter.loadRepositories(MockFactory.TEST_USERNAME_ERROR); verify(userDetailsView).showMessage("Error loading repositories"); }
@Test public void loadRepositoriesShouldHideProgressIndicatorOnComplete() { userDetailsPresenter.loadRepositories(MockFactory.TEST_USERNAME); verify(userDetailsView).hideProgressIndicator(); }