SessionRecyclerAdapter extends CardRecyclerAdapter { public void setThisDevice(MyDeviceCard myDevice, boolean notify) { boolean wasnull = thisDevice == null; thisDevice = myDevice; if (notify) { if (wasnull) { notifyItemInserted(findThisDevicePos()); } else { notifyItemChanged(findThisDevicePos()); } } } SessionRecyclerAdapter(SessionPresenter presenter);   SessionRecyclerAdapter(); @Override android.databinding.DataBindingComponent getBindingComponent(); @Override void applyAdditionalBinding(Card card, CardViewHolder holder); void setNotifications(List<NotifCard> notifs, boolean notify); void setFolders(List<FolderCard> folders, boolean notify); void setThisDevice(MyDeviceCard myDevice, boolean notify); void setDevices(List<DeviceCard> devices, boolean notify); Card getItem(int pos); @Override int getItemCount(); @Override long getItemId(int position);  }
@Test public void testSetThisDevice() { List<FolderCard> folders = new LinkedList<>(); folders.add(new FolderCard(null, null, null)); folders.add(new FolderCard(null, null, null)); adapter.setFolders(folders, false); adapter.setThisDevice(new MyDeviceCard(null, null, null, null), true); verify(adapter).notifyItemInserted(4); adapter.setThisDevice(new MyDeviceCard(null, null, null, null), true); verify(adapter).notifyItemChanged(4); }