AddNewAddressPresenter extends BasePresenter<AddNewAddressContract.View> implements AddNewAddressContract.Presenter { @Override public boolean checkAddressName(String name) { String errMsg = null; if (TextUtils.isEmpty(name.trim())) { errMsg = string(R.string.address_name_cannot_be_empty); } else { if (name.length() > 20) { errMsg = string(R.string.address_name_length_error); } } if (TextUtils.isEmpty(errMsg)) { getView().setNameVisibility(View.GONE); } else { getView().showNameError(errMsg); } return TextUtils.isEmpty(errMsg); }  @Override void getIntentData(); @Override void loadAddressInfo(); @Override void addAddress(); @Override boolean checkAddressName(String name); @Override boolean checkAddress(String address); @Override void validQRCode(String text);  }
@Test public void checkAddressName(){ String validName = "Ella"; String invalidName = ""; boolean checkAddressNameBool = presenter.checkAddressName(validName); LogUtils.i( "------checkAddressNameBool result:" + checkAddressNameBool); Mockito.verify(view).setNameVisibility(Mockito.anyInt()); }