### Question:
SearchListPresenter extends BasePresenter<SearchListContract.View> implements SearchListContract.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  SearchListPresenter(DataManager dataManager); @Override void attachView(SearchListContract.View view); @Override void getSearchList(int page, String k, boolean isShowError); @Override void addCollectArticle(int position, FeedArticleData feedArticleData); @Override void cancelCollectArticle(int position, FeedArticleData feedArticleData); @Override boolean getNightModeState();  }### Answer:
@Test public void addCollectFail() { CookiesManager.clearAllCookies(); FeedArticleData feedArticleData = new FeedArticleData(); feedArticleData.setCollect(false); mSearchListPresenter.addCollectArticle(0, feedArticleData); Mockito.verify(mView).showErrorMsg(mApplication.getString(R.string.collect_fail)); Mockito.verify(mView).showError(); }
@Test public void addCollectSuccess() { login(); FeedArticleData feedArticleData = new FeedArticleData(); feedArticleData.setCollect(false); mSearchListPresenter.addCollectArticle(0, feedArticleData); Mockito.verify(mView).showCollectArticleData(ArgumentMatchers.eq(0), ArgumentMatchers.eq(feedArticleData), ArgumentMatchers.any(FeedArticleListData.class)); }