### Question:
MainPagerPresenter extends BasePresenter<MainPagerContract.View> implements MainPagerContract.Presenter { @Override public void addCollectArticle(int position, FeedArticleData feedArticleData) { addSubscribe(mDataManager.addCollectArticle(feedArticleData.getId()) .compose(RxUtils.rxSchedulerHelper()) .compose(RxUtils.handleCollectResult()) .subscribeWith(new BaseObserver<FeedArticleListData>(mView, WanAndroidApp.getInstance().getString(R.string.collect_fail)) { @Override public void onNext(FeedArticleListData feedArticleListData) { feedArticleData.setCollect(true); mView.showCollectArticleData(position, feedArticleData, feedArticleListData); } })); } @Inject  MainPagerPresenter(DataManager dataManager); @Override void attachView(MainPagerContract.View view); @Override String getLoginAccount(); @Override String getLoginPassword(); @Override void loadMainPagerData(); @Override void autoRefresh(boolean isShowError); @Override void loadMore(); @Override void getBannerData(boolean isShowError); @Override void getFeedArticleList(boolean isShowError); @Override void loadMoreData(); @Override void addCollectArticle(int position, FeedArticleData feedArticleData); @Override void cancelCollectArticle(int position, FeedArticleData feedArticleData);  }### Answer:
@Test public void addCollectArticleSuccess() { login(); FeedArticleData feedArticleData = getFeedArticleData(); mMainPagerPresenter.addCollectArticle(0, feedArticleData); Mockito.verify(mView).showCollectArticleData(ArgumentMatchers.eq(0), ArgumentMatchers.eq(feedArticleData), ArgumentMatchers.any(FeedArticleListData.class)); }
@Test public void addCollectArticleFail() { CookiesManager.clearAllCookies(); FeedArticleData feedArticleData = getFeedArticleData(); mMainPagerPresenter.addCollectArticle(0, feedArticleData); Mockito.verify(mView).showErrorMsg(mApplication.getString(R.string.collect_fail)); Mockito.verify(mView).showError(); }