SessionRecyclerAdapter extends CardRecyclerAdapter { public void setNotifications(List<NotifCard> notifs, boolean notify) { updateList(notifications, notifs, this::findNotificationOffset, 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 testNotificationAdd() { List<NotifCard> notifs = new LinkedList<>(); notifs.add(new NotifCardRestart(null)); notifs.add(new NotifCardRestart(null)); adapter.setNotifications(notifs, true); verify(adapter).notifyItemRangeInserted(0, 2); }
@Test public void testNotificationReplaceMore() { List<NotifCard> notifs = new LinkedList<>(); notifs.add(new NotifCardRestart(null)); notifs.add(new NotifCardRestart(null)); adapter.setNotifications(notifs, false); List<NotifCard> notifs2 = new LinkedList<>(); notifs2.add(new NotifCardRestart(null)); notifs2.add(new NotifCardRestart(null)); notifs2.add(new NotifCardRestart(null)); notifs2.add(new NotifCardRestart(null)); adapter.setNotifications(notifs2, true); verify(adapter).notifyItemRangeChanged(0, 2); verify(adapter).notifyItemRangeInserted(2, 2); }
@Test public void testNotificationReplaceLess() { List<NotifCard> notifs2 = new LinkedList<>(); notifs2.add(new NotifCardRestart(null)); notifs2.add(new NotifCardRestart(null)); notifs2.add(new NotifCardRestart(null)); notifs2.add(new NotifCardRestart(null)); notifs2.add(new NotifCardRestart(null)); notifs2.add(new NotifCardRestart(null)); notifs2.add(new NotifCardRestart(null)); adapter.setNotifications(notifs2, false); List<NotifCard> notifs = new LinkedList<>(); notifs.add(new NotifCardRestart(null)); notifs.add(new NotifCardRestart(null)); notifs.add(new NotifCardRestart(null)); adapter.setNotifications(notifs, true); verify(adapter).notifyItemRangeChanged(0, 3); verify(adapter).notifyItemRangeRemoved(3, 4); }