### Question:
LoginPresenter extends BasePresenter<LoginContract.View> implements LoginContract.Presenter { @Override public void getLoginData(String username, String password) { if (TextUtils.isEmpty(username) || TextUtils.isEmpty(password)) { mView.showSnackBar(WanAndroidApp.getInstance().getString(R.string.account_password_null_tint)); return; } addSubscribe(mDataManager.getLoginData(username, password) .compose(RxUtils.rxSchedulerHelper()) .compose(RxUtils.handleResult()) .subscribeWith(new BaseObserver<LoginData>(mView, WanAndroidApp.getInstance().getString(R.string.login_fail)) { @Override public void onNext(LoginData loginData) { setLoginAccount(loginData.getUsername()); setLoginPassword(loginData.getPassword()); setLoginStatus(true); RxBus.getDefault().post(new LoginEvent(true)); mView.showLoginSuccess(); } })); } @Inject  LoginPresenter(DataManager dataManager); @Override void getLoginData(String username, String password);  }### Answer:
@Test public void noInputUsernameOrPassword() { mLoginPresenter.getLoginData("", ""); Mockito.verify(mView).showSnackBar(mApplication.getString(R.string.account_password_null_tint)); }
@Test public void inputErrorUserNameOrPassword() { mLoginPresenter.getLoginData("2243963927", "qaz"); Mockito.verify(mView).showErrorMsg(mApplication.getString(R.string.login_fail)); Mockito.verify(mView).showError(); }