MovieDetailsPresenterImpl implements MovieDetailsPresenter { @Override public void showReviews(Movie movie) { reviewSubscription = movieDetailsInteractor.getReviews(movie.getId()).subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(this::onGetReviewsSuccess, t -> onGetReviewsFailure()); } MovieDetailsPresenterImpl(MovieDetailsInteractor movieDetailsInteractor, FavoritesInteractor favoritesInteractor); @Override void setView(MovieDetailsView view); @Override void destroy(); @Override void showDetails(Movie movie); @Override void showTrailers(Movie movie); @Override void showReviews(Movie movie); @Override void showFavoriteButton(Movie movie); @Override void onFavoriteClick(Movie movie);  }
@Test public void shouldBeAbleToShowReviews() { Observable<List<Review>> responseObservable = Observable.just(reviews); when(movie.getId()).thenReturn("12345"); when(movieDetailsInteractor.getReviews(movie.getId())).thenReturn(responseObservable); movieDetailsPresenter.showReviews(movie); verify(view).showReviews(reviews); }
@Test public void shouldFailSilentlyWhenNoReviews() throws Exception { when(movie.getId()).thenReturn("12345"); when(movieDetailsInteractor.getReviews(movie.getId())).thenReturn(Observable.error(new SocketTimeoutException())); movieDetailsPresenter.showReviews(movie); verifyZeroInteractions(view); }