ConversationsAdapter extends RecyclerView.Adapter<ConversationViewHolder> { @NonNull public List<ExampleConversation> getSelectedConversations() { ArrayList<ExampleConversation> selected = new ArrayList<>(); for (Integer position : mSelectionHelper.getSelectedItems()) { selected.add(mConversations.get(position)); } return selected; } ConversationsAdapter(@NonNull ConversationViewHolder.OnConversationClickedListener clickedListener); void setSelectionHelper(@NonNull MultiSelectionHelper selectionHelper); void setConversations(List<ExampleConversation> conversations); @NonNull List<ExampleConversation> getSelectedConversations(); @Override ConversationViewHolder onCreateViewHolder(ViewGroup parent, int viewType); @Override void onBindViewHolder(ConversationViewHolder holder, int position); @Override int getItemCount();  }
@Test public void getSelectedItemsNoSelection() { when(mSelectionHelper.getSelectedItems()).thenReturn(Collections.emptySet()); List<ExampleConversation> selected = mAdapter.getSelectedConversations(); assertEquals(0, selected.size()); }