ImgurMvpPresenter extends BasePresenter<ImgurMvpView> { public void refreshTopics() { imgurApi.defaultTopics() .map(TopicResponse::getData) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .compose(view().bind()) .compose(view().injectProgress()) .subscribe(topics -> { view().showTopics(topics); }, throwable -> { view().showThrowable(throwable); }); } @Inject  ImgurMvpPresenter(ImgurApi imgurApi); void refreshTopics();  }
@Test public void testRefreshTopics() throws Exception { TopicResponse response = new TopicResponse(); List<Topic> topics = Lists.newArrayList(new Topic(), new Topic(), new Topic()); response.setData(topics); given(imgurApi.defaultTopics()).willReturn(Observable.just(response)); presenter.refreshTopics(); proxy.advanceBy(1, TimeUnit.SECONDS); verify(view, times(1)).bind(); verify(view, times(1)).injectProgress(); verify(view, times(1)).showTopics(topics); }