DateHeaderViewHolder extends DataViewHolder<EventItem> { @Override public void populate(EventItem eventItem) { headerText.setText(formatDate(headerText.getContext(), eventItem.getHeader())); } DateHeaderViewHolder(View v); @Override void populate(EventItem eventItem);  }
@Test public void populate() { View view = inflate(R.layout.item_date_header); DateHeaderViewHolder viewHolder = new DateHeaderViewHolder(view); EventItem item = generate(EventItem.class); Context c = ApplicationProvider.getApplicationContext(); String expectedDate = DateHeaderViewHolder.formatDate(c, item.getHeader()); viewHolder.populate(item); TextView textView = view.findViewById(R.id.date_header); assertEquals(expectedDate, textView.getText()); }