@Test public void shouldObtainTextFromAttrs() { String expectedTitle = context.getString(R.string.lib_sign_in_with_google); AttributeSet attributeSet = AttributeSetBuilder.from(context) .addAttribute("lib_signInText", "@string/lib_sign_in_with_google") .build(); SignInButton signInButton = new SignInButton(context, attributeSet); assertThat(signInButton.getText()).isEqualTo(expectedTitle); }
@VisibleForTesting String getText() { return buttonText.getText().toString(); }
SignInButton extends FrameLayout { @VisibleForTesting String getText() { return buttonText.getText().toString(); } }
SignInButton extends FrameLayout { @VisibleForTesting String getText() { return buttonText.getText().toString(); } SignInButton(Context context);  SignInButton(Context context, AttributeSet attrs);  SignInButton(Context context, AttributeSet attrs, int defStyleAttr); }
SignInButton extends FrameLayout { @VisibleForTesting String getText() { return buttonText.getText().toString(); } SignInButton(Context context);  SignInButton(Context context, AttributeSet attrs);  SignInButton(Context context, AttributeSet attrs, int defStyleAttr); void setText(@StringRes int text); void setTextSize(@DimenRes int textSize); void setColor(@ColorRes int color); void setIcon(@DrawableRes int icon); void setTextColor(@ColorRes int textColor); }
SignInButton extends FrameLayout { @VisibleForTesting String getText() { return buttonText.getText().toString(); } SignInButton(Context context);  SignInButton(Context context, AttributeSet attrs);  SignInButton(Context context, AttributeSet attrs, int defStyleAttr); void setText(@StringRes int text); void setTextSize(@DimenRes int textSize); void setColor(@ColorRes int color); void setIcon(@DrawableRes int icon); void setTextColor(@ColorRes int textColor);  }