WaypointListAdapter extends RecyclerView.Adapter<WaypointListAdapter.WaypointsListViewHolder> { @Override public int getItemCount() { return mWaypointEntryList.size(); } WaypointListAdapter(@NonNull final List<WaypointEntry> entries); @Override void onAttachedToRecyclerView(final RecyclerView recyclerView); @Override int getItemCount(); @Override WaypointsListViewHolder onCreateViewHolder(final ViewGroup parent, final int viewType); @Override void onBindViewHolder(final WaypointsListViewHolder holder, final int position); void setListener(final WaypointList.Listener listener);  }
@Test public void itemCount() { final WaypointEntry entry = MockUtils.mockWayPointEntry(); mWaypointListAdapter = new WaypointListAdapter(Arrays.asList(entry, entry, entry)); assertThat(mWaypointListAdapter.getItemCount(), equalTo(3)); }
@Test public void removeButtonShouldRemoveRowAndCallCallback() { final WaypointEntry entry = MockUtils.mockWayPointEntry(); getFirstViewHolder(new ArrayList<>(Collections.singletonList(entry))); assertThat(mWaypointsListViewHolder.getRemovableView().getVisibility(), equalTo(View.VISIBLE)); mWaypointsListViewHolder.getRemovableView() .performClick(); assertThat(mIsCallbackCalled, is(true)); assertThat(mWaypointListAdapter.getItemCount(), equalTo(0)); }