GridItemView extends FrameLayout { public void setPrimaryTextColor(ColorStateList color) { primaryTextColorStateList = color; primaryTextView.setTextColor(color); } GridItemView(Context context);  GridItemView(Context context, AttributeSet attrs);  GridItemView(Context context, AttributeSet attrs, int defStyleAttr); @TargetApi(21)  GridItemView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes); @GridItemVariant int getVariant(); void setVariant(@GridItemVariant int variant); CharSequence getPrimaryText(); void setPrimaryText(@StringRes int textRes); void setPrimaryText(CharSequence text); ColorStateList getPrimaryTextColors(); @ColorInt int getCurrentPrimaryTextColor(); void setPrimaryTextColor(ColorStateList color); void setPrimaryTextColor(@ColorInt int color); void setPrimaryTextColorRes(@ColorRes int colorRes); CharSequence getSecondaryText(); void setSecondaryText(@StringRes int textRes); void setSecondaryText(CharSequence text); ColorStateList getSecondaryTextColors(); @ColorInt int getCurrentSecondaryTextColor(); void setSecondaryTextColor(ColorStateList color); void setSecondaryTextColor(@ColorInt int color); void setSecondaryTextColorRes(@ColorRes int colorRes); Drawable getIcon(); void setIcon(@DrawableRes int iconRes); void setIcon(Drawable icon); @IconGravity int getIconGravity(); void setIconGravity(@IconGravity int iconGravity); static final int VARIANT_ONE_LINE_TEXT; static final int VARIANT_ONE_LINE_TEXT_ICON; static final int VARIANT_TWO_LINE_TEXT; static final int VARIANT_TWO_LINE_TEXT_ICON; static final int ICON_GRAVITY_START; static final int ICON_GRAVITY_END; }
@Test public void givenStateList_whenSetPrimaryTextColor_thenHasPrimaryTextColor() { final ColorStateList expectedColor = createColorStateList(Color.DKGRAY, Color.RED); gridItemView.setPrimaryTextColor(expectedColor); assertThat(gridItemView) .hasPrimaryTextColor(expectedColor); }
@Test public void givenColorValue_whenSetPrimaryTextColor_thenHasPrimaryTextColor() { final int expectedColor = Color.BLUE; gridItemView.setPrimaryTextColor(expectedColor); assertThat(gridItemView) .hasPrimaryTextColor(expectedColor); }