ErrorEditText extends TextInputEditText { @Nullable public TextInputLayout getTextInputLayoutParent() { if (getParent() != null && getParent().getParent() instanceof TextInputLayout) { return (TextInputLayout) getParent().getParent(); } return null; } ErrorEditText(Context context);  ErrorEditText(Context context, AttributeSet attrs);  ErrorEditText(Context context, AttributeSet attrs, int defStyle); @Override void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter); void setFieldHint(int hint); void setFieldHint(String hint); @SuppressWarnings("WrongConstant") View focusNextView(); void setOptional(boolean optional); boolean isOptional(); boolean isError(); void setError(@Nullable String errorMessage); boolean isValid(); String getErrorMessage(); void validate(); void closeSoftKeyboard(); @Nullable TextInputLayout getTextInputLayoutParent();  }
@Test public void getTextInputLayoutParent_returnsTextInputLayout() { mView = (CardEditText) Robolectric.setupActivity(TestActivity.class) .findViewById(R.id.bt_card_form_card_number); assertNotNull(mView.getTextInputLayoutParent()); }
@Test public void getTextInputLayoutParent_returnsNullIfParentNotPresent() { assertNull(mView.getTextInputLayoutParent()); }