SessionRecyclerAdapter extends CardRecyclerAdapter { public void setFolders(List<FolderCard> folders, boolean notify) { updateList(folderItems, folders, this::findFolderOffset, notify); } 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 testFolderReplaceLess() { List<FolderCard> folders2 = new LinkedList<>(); FolderConfig f3 = new FolderConfig(); f3.id = "id1"; folders2.add(new FolderCard(null, f3, null)); FolderConfig f4 = new FolderConfig(); f4.id = "id2"; folders2.add(new FolderCard(null, f4, null)); FolderConfig f5 = new FolderConfig(); f5.id = "id3"; folders2.add(new FolderCard(null, f5, null)); FolderConfig f6 = new FolderConfig(); f6.id = "id4"; folders2.add(new FolderCard(null, f6, null)); adapter.setFolders(folders2, false); List<FolderCard> folders = new LinkedList<>(); FolderConfig f1 = new FolderConfig(); f1.id = "id1"; folders.add(new FolderCard(null, f1, null)); FolderConfig f2 = new FolderConfig(); f2.id = "id2"; folders.add(new FolderCard(null, f2, null)); adapter.setFolders(folders, true); verify(adapter).notifyItemRangeChanged(1,2); verify(adapter).notifyItemRangeRemoved(3, 2); }