### Question:
TreeList { void callOnSelectionChanged() { if (!Objects.isNull(getOnSelectionChanged())) { getOnSelectionChanged().accept(getSelectedItems()); } } @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 testCallOnSelectionChanged() { final List selectedItems = mock(List.class); final Consumer consumer = mock(Consumer.class); doReturn(consumer).when(treeList).getOnSelectionChanged(); doReturn(selectedItems).when(treeList).getSelectedItems(); treeList.callOnSelectionChanged(); verify(consumer).accept(selectedItems); }