### Question:
RegisterPresenter extends BasePresenter<RegisterContract.View> implements RegisterContract.Presenter { @Override public void getRegisterData(String username, String password, String rePassword) { if (TextUtils.isEmpty(username) || TextUtils.isEmpty(password) || TextUtils.isEmpty(rePassword)) { mView.showSnackBar(WanAndroidApp.getInstance().getString(R.string.account_password_null_tint)); return; } if (!password.equals(rePassword)) { mView.showSnackBar(WanAndroidApp.getInstance().getString(R.string.password_not_same)); return; } addSubscribe(mDataManager.getRegisterData(username, password, rePassword) .compose(RxUtils.rxSchedulerHelper()) .compose(RxUtils.handleResult()) .filter(loginResponse -> !TextUtils.isEmpty(username) && !TextUtils.isEmpty(password) && !TextUtils.isEmpty(rePassword)) .subscribeWith(new BaseObserver<LoginData>(mView, WanAndroidApp.getInstance().getString(R.string.register_fail)) { @Override public void onNext(LoginData loginData) { mView.showRegisterSuccess(); } })); } @Inject  RegisterPresenter(DataManager dataManager); @Override void getRegisterData(String username, String password, String rePassword);  }### Answer:
@Test public void noInputAllInfo() { mRegisterPresenter.getRegisterData("JsonChao", "", "123"); Mockito.verify(mView).showSnackBar(mApplication.getString(R.string.account_password_null_tint)); }
@Test public void inputPasswordMismatching() { mRegisterPresenter.getRegisterData("JsonChao", "qaz", "qaz123"); Mockito.verify(mView).showSnackBar(mApplication.getString(R.string.password_not_same)); }
@Test public void inputCorrectInfo() { mRegisterPresenter.getRegisterData("13458524151", "qaz123", "qaz123"); Mockito.verify(mView).showRegisterSuccess(); }
@Test public void inputExistInfo() { mRegisterPresenter.getRegisterData("2243963927", "qaz123", "qaz123"); Mockito.verify(mView).showErrorMsg(mApplication.getString(R.string.register_fail)); Mockito.verify(mView).showError(); }