@Test public void testInitNoMore() throws Exception { int topicId = 0; TopicAndReplies topicAndReplies = mock(TopicAndReplies.class); topicAndReplies.replies = mock(ArrayList.class); when(topicAndReplies.replies.size()).thenReturn(10); when(mTopicDetailView.isRefreshing()).thenReturn(false); when(mTopicDetailView.getTopicId()).thenReturn(topicId); when(mDataManager.getTopicAndComments(topicId)) .thenReturn(Single.just(topicAndReplies)); mPresenter.onRefresh(); verify(mTopicDetailView).showTopicAndReplies(any(TopicAndReplies.class)); verify(mTopicDetailView).showLoadNoMore(); }
public void onRefresh() { getDisposable().clear(); final ITopicDetailView view = getView(); if (!view.isRefreshing()) { view.changeStateView(MultiStateView.VIEW_STATE_LOADING); } addDisposable(mDataManager.getTopicAndComments(view.getTopicId()) .subscribe(this::loadTopicAndRepliesNext, this::loadTopicAndRepliesError)); }
TopicDetailPresenter extends BasePresenter<ITopicDetailView> { public void onRefresh() { getDisposable().clear(); final ITopicDetailView view = getView(); if (!view.isRefreshing()) { view.changeStateView(MultiStateView.VIEW_STATE_LOADING); } addDisposable(mDataManager.getTopicAndComments(view.getTopicId()) .subscribe(this::loadTopicAndRepliesNext, this::loadTopicAndRepliesError)); } }
TopicDetailPresenter extends BasePresenter<ITopicDetailView> { public void onRefresh() { getDisposable().clear(); final ITopicDetailView view = getView(); if (!view.isRefreshing()) { view.changeStateView(MultiStateView.VIEW_STATE_LOADING); } addDisposable(mDataManager.getTopicAndComments(view.getTopicId()) .subscribe(this::loadTopicAndRepliesNext, this::loadTopicAndRepliesError)); } @Inject  TopicDetailPresenter(DataManager dataManager, RxBus bus); }
TopicDetailPresenter extends BasePresenter<ITopicDetailView> { public void onRefresh() { getDisposable().clear(); final ITopicDetailView view = getView(); if (!view.isRefreshing()) { view.changeStateView(MultiStateView.VIEW_STATE_LOADING); } addDisposable(mDataManager.getTopicAndComments(view.getTopicId()) .subscribe(this::loadTopicAndRepliesNext, this::loadTopicAndRepliesError)); } @Inject  TopicDetailPresenter(DataManager dataManager, RxBus bus); @Override void onAttach(ITopicDetailView view); void onRefresh(); void loadMoreReplies(); }
TopicDetailPresenter extends BasePresenter<ITopicDetailView> { public void onRefresh() { getDisposable().clear(); final ITopicDetailView view = getView(); if (!view.isRefreshing()) { view.changeStateView(MultiStateView.VIEW_STATE_LOADING); } addDisposable(mDataManager.getTopicAndComments(view.getTopicId()) .subscribe(this::loadTopicAndRepliesNext, this::loadTopicAndRepliesError)); } @Inject  TopicDetailPresenter(DataManager dataManager, RxBus bus); @Override void onAttach(ITopicDetailView view); void onRefresh(); void loadMoreReplies();  }