SpecialEventCardViewHolder extends DataViewHolder<Card> implements SwipeDismissableViewHolder { @Override public void populate(Card card) { SpecialEventCard eventCard = card.checkCard(Card.Type.SPECIAL_EVENT); event = eventCard.getSpecialEvent(); title.setText(event.getName()); text.setText(event.getSimpleText()); Picasso.get().load(event.getImage()).into(image); itemView.setOnClickListener(v -> NetworkUtils.maybeLaunchIntent(v.getContext(), event.getViewIntent(v.getContext()))); this.card = card; } SpecialEventCardViewHolder(View itemView, HomeFeedAdapter.AdapterCompanion companion); @Override void populate(Card card); @Override void onSwiped(); @Override boolean isSwipeEnabled();  }
@Test public void populate() { View view = inflate(activityContext, R.layout.home_card_special); SpecialEventCardViewHolder cardViewHolder = new SpecialEventCardViewHolder(view, adapter.getCompanion()); SpecialEventCard card = generate(SpecialEventCard.class); SpecialEvent event = card.getSpecialEvent(); event.setInApp("test"); cardViewHolder.populate(card); assertTextIs(event.getName(), view.findViewById(R.id.title)); assertTextIs(event.getSimpleText(), view.findViewById(R.id.text)); view.performClick(); Intent expected = new Intent(Intent.ACTION_VIEW, Uri.parse(event.getLink())); Intent actual = getShadowApplication().getNextStartedActivity(); assertEquals(expected.getComponent(), actual.getComponent()); }