### Question:
TreeList { public List<TreeListItem> getSelectedItems() { return getCurrentItems().stream() .filter(item -> item.getIsSelected()) .collect(Collectors.toList()); } @Inject  TreeList(final View view); void populate(final List<TreeListItem> items); void refresh(); List<TreeListItem> getCurrentItems(); void clear(); Node getElement(); void clearSelection(); List<TreeListItem> getSelectedItems(); void setOnSelectionChanged(final Consumer<List<TreeListItem>> onSelectionChanged);  }### Answer:
@Test public void testGetSelectedItems() { when(itemThree.getIsSelected()).thenReturn(true); final List<TreeListItem> selectedItems = treeList.getSelectedItems(); assertTrue(selectedItems.contains(itemThree)); assertFalse(selectedItems.contains(itemOne)); assertFalse(selectedItems.contains(itemTwo)); }