ListItemView extends FrameLayout { public void setPrimaryText(@StringRes int textRes) { setPrimaryText(getContext().getString(textRes)); } ListItemView(Context context);  ListItemView(Context context, AttributeSet attrs);  ListItemView(Context context, AttributeSet attrs, int defStyleAttr); @TargetApi(21)  ListItemView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes); @ListItemVariant int getVariant(); void setVariant(@ListItemVariant int variant); CharSequence getPrimaryText(); void setPrimaryText(@StringRes int textRes); void setPrimaryText(CharSequence text); @Nullable CharSequence getSecondaryText(); void setSecondaryText(@StringRes int textRes); void setSecondaryText(CharSequence text); @Nullable CharSequence getTertiaryText(); void setTertiaryText(@StringRes int textRes); void setTertiaryText(CharSequence text); @Nullable Drawable getIcon(); void setIcon(@DrawableRes int iconRes); void setIcon(Drawable icon); @Nullable Drawable getAvatar(); void setAvatar(@DrawableRes int avatarRes); void setAvatar(Drawable avatar); static final int VARIANT_ONE_LINE_TEXT; static final int VARIANT_ONE_LINE_TEXT_ICON; static final int VARIANT_ONE_LINE_TEXT_AVATAR; static final int VARIANT_ONE_LINE_TEXT_ICON_AVATAR; static final int VARIANT_TWO_LINE_TEXT; static final int VARIANT_TWO_LINE_TEXT_ICON; static final int VARIANT_TWO_LINE_TEXT_AVATAR; static final int VARIANT_TWO_LINE_TEXT_ICON_AVATAR; static final int VARIANT_THREE_LINE_TEXT; static final int VARIANT_THREE_LINE_TEXT_ICON; static final int VARIANT_THREE_LINE_TEXT_AVATAR; static final int VARIANT_THREE_LINE_TEXT_ICON_AVATAR; }
@Test public void givenStringResource_whenSetPrimaryText_thenHasPrimaryText() { listItemView.setPrimaryText(R.string.list_item_avatar_cd); assertThat(listItemView) .hasPrimaryText("Avatar"); }
@Test public void whenSetPrimaryText_thenHasPrimaryText() { final String expectedText = "someText"; listItemView.setPrimaryText(expectedText); assertThat(listItemView) .hasPrimaryText(expectedText); }