### Question:
ProjectListPresenter extends BasePresenter<ProjectListContract.View> implements ProjectListContract.Presenter { @Override public void cancelCollectArticle(int position, FeedArticleData feedArticleData) { addSubscribe(mDataManager.cancelCollectArticle(feedArticleData.getId()) .compose(RxUtils.rxSchedulerHelper()) .compose(RxUtils.handleCollectResult()) .subscribeWith(new BaseObserver<FeedArticleListData>(mView, WanAndroidApp.getInstance().getString(R.string.cancel_collect_fail)) { @Override public void onNext(FeedArticleListData feedArticleListData) { feedArticleData.setCollect(false); mView.showCancelCollectArticleData(position, feedArticleData, feedArticleListData); } })); } @Inject  ProjectListPresenter(DataManager dataManager); @Override void attachView(ProjectListContract.View view); @Override void getProjectListData(int page, int cid, boolean isShowError); @Override void addCollectOutsideArticle(int position, FeedArticleData feedArticleData); @Override void cancelCollectArticle(int position, FeedArticleData feedArticleData);  }### Answer:
@Test public void cancelCollectArticleSuccess() { login(); FeedArticleData feedArticleData = new FeedArticleData(); feedArticleData.setId(0); feedArticleData.setCollect(true); mProjectListPresenter.cancelCollectArticle(0, feedArticleData); Mockito.verify(mView).showCancelCollectArticleData(ArgumentMatchers.eq(0), ArgumentMatchers.eq(feedArticleData), ArgumentMatchers.any(FeedArticleListData.class)); }
@Test public void cancelCollectArticleFail() { CookiesManager.clearAllCookies(); FeedArticleData feedArticleData = new FeedArticleData(); feedArticleData.setId(0); feedArticleData.setCollect(true); mProjectListPresenter.cancelCollectArticle(0, feedArticleData); Mockito.verify(mView).showErrorMsg(mApplication.getString(R.string.cancel_collect_fail)); Mockito.verify(mView).showError(); }