CardEditText extends ErrorEditText implements TextWatcher { @Override public String getErrorMessage() { if (TextUtils.isEmpty(getText())) { return getContext().getString(R.string.bt_card_number_required); } else { return getContext().getString(R.string.bt_card_number_invalid); } } CardEditText(Context context);  CardEditText(Context context, AttributeSet attrs);  CardEditText(Context context, AttributeSet attrs, int defStyle); void displayCardTypeIcon(boolean display); CardType getCardType(); void setMask(boolean mask); void setOnCardTypeChangedListener(OnCardTypeChangedListener listener); @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_returnsErrorMessageWhenEmpty() { assertEquals(RuntimeEnvironment.application.getString(R.string.bt_card_number_required), mView.getErrorMessage()); }
@Test public void getErrorMessage_returnsErrorMessageWhenNotEmpty() { type("4"); assertEquals(RuntimeEnvironment.application.getString(R.string.bt_card_number_invalid), mView.getErrorMessage()); }