CitiesFallbackAdapter extends BaseHeaderAdapter<Void, City, BaseRecyclerViewHolder<Void>, BaseRecyclerViewHolder<City>> implements View.OnClickListener { @Override public void onClick(View v) { CitiesFallbackEntryView view = (CitiesFallbackEntryView) v.getTag(); City city = view.getData(); mListener.onCitySelected(city); } CitiesFallbackAdapter(@NonNull OnCitySelectedListener listener); @Override void onClick(View v);  }
@Test public void should_call_listener_with_given_city_data_when_entry_is_selected() { City city = new City(); city.name = "Franconville"; CitiesFallbackEntryView entryView = mock(CitiesFallbackEntryView.class); when(entryView.getData()).thenReturn(city); View view = new View(RuntimeEnvironment.application); view.setTag(entryView); adapter.onClick(view); verify(listener).onCitySelected(city); }