SessionRecyclerAdapter extends CardRecyclerAdapter { public Card getItem(int pos) { final int origpos = pos; if (pos < notifications.size()) { return notifications.get(pos); } pos -= notifications.size(); if (folderHeader != null) { if (pos == 0) { return folderHeader; } pos--; } if (pos < folderItems.size()) { return folderItems.get(pos); } pos -= folderItems.size(); if (deviceHeader != null) { if (pos == 0) { return deviceHeader; } pos--; } if (thisDevice != null) { if (pos == 0) { return thisDevice; } pos--; } if (pos < deviceItems.size()) { return deviceItems.get(pos); } throw new IllegalArgumentException(dump() + ", pos " + pos + ", orig "+origpos); } 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 testgetItem() { List<NotifCard> notifs = new LinkedList<>(); notifs.add(new NotifCardRestart(null)); notifs.add(new NotifCardRestart(null)); adapter.setNotifications(notifs, false); List<FolderCard> folders = new LinkedList<>(); folders.add(new FolderCard(null, null, null)); folders.add(new FolderCard(null, null, null)); folders.add(new FolderCard(null, null, null)); adapter.setFolders(folders, false); MyDeviceCard myDevice = new MyDeviceCard(null, null, null, null); adapter.setThisDevice(myDevice, true); List<DeviceCard> devices = new LinkedList<>(); devices.add(new DeviceCard(null, null, null, null, 0)); devices.add(new DeviceCard(null, null, null, null, 0)); devices.add(new DeviceCard(null, null, null, null, 0)); adapter.setDevices(devices, false); assertTrue((notifs.get(0) == adapter.getItem(0))); assertTrue((folders.get(1) == adapter.getItem(4))); assertTrue((myDevice == adapter.getItem(7))); assertTrue((devices.get(1) == adapter.getItem(9))); assertEquals(11, adapter.getItemCount()); }