DirectoryAdapter extends RecyclerView.Adapter<DirectoryAdapter.ViewHolder> { @Override public DirectoryAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View root = LayoutInflater.from(parent.getContext()) .inflate(R.layout.item, parent, false); ViewHolder viewHolder = new ViewHolder(root); return viewHolder; } DirectoryAdapter(DirectoryList dataSet, EventBus bus); @Override DirectoryAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
                                                          int viewType); @Override void onBindViewHolder(ViewHolder holder, int position); @Override int getItemCount();  }
@Ignore @Test public void onFileClickedShouldUpdateDirectoryTree() throws Exception { File expectedClickedFile = mock(File.class); ViewGroup fakeViewGroup = new RelativeLayout(ShadowApplication.getInstance().getApplicationContext()); DirectoryAdapter.ViewHolder viewHolder = spy(sut.onCreateViewHolder(fakeViewGroup, 0)); when(viewHolder.getAdapterPosition()).thenReturn(0); dataSet.directoryList.add(expectedClickedFile); viewHolder.onClick(mock(View.class)); verify(mockBus).post(eq(new UpdateDirectoryTreeEvent(expectedClickedFile))); }