CvvEditText extends ErrorEditText implements TextWatcher { @Override public String getErrorMessage() { String securityCodeName; if (mCardType == null) { securityCodeName = getContext().getString(R.string.bt_cvv); } else { securityCodeName = getContext().getString(mCardType.getSecurityCodeName()); } if (TextUtils.isEmpty(getText())) { return getContext().getString(R.string.bt_cvv_required, securityCodeName); } else { return getContext().getString(R.string.bt_cvv_invalid, securityCodeName); } } CvvEditText(Context context);  CvvEditText(Context context, AttributeSet attrs);  CvvEditText(Context context, AttributeSet attrs, int defStyle); void setCardType(CardType cardType); void setMask(boolean mask); @Override void afterTextChanged(Editable editable); @Override boolean isValid(); @Override String getErrorMessage(); @Override void beforeTextChanged(CharSequence s, int start, int count, int after);  }
@Test public void getErrorMessage_returnsErrorMessageForNoCardTypeWhenEmpty() { String expectedMessage = RuntimeEnvironment.application.getString(R.string.bt_cvv_required, RuntimeEnvironment.application.getString(R.string.bt_cvv)); assertEquals(expectedMessage, mView.getErrorMessage()); }
@Test public void getErrorMessage_returnsErrorMessageForNoCardTypeWhenNotEmpty() { type("4"); String expectedMessage = RuntimeEnvironment.application.getString(R.string.bt_cvv_invalid, RuntimeEnvironment.application.getString(R.string.bt_cvv)); assertEquals(expectedMessage, mView.getErrorMessage()); }