@Test public void testOnSelectionChanged() { final DataObject do1 = mock(DataObject.class); final DataObject do2 = mock(DataObject.class); final DataObject do3 = mock(DataObject.class); final TreeListItem treeListItem1 = mock(TreeListItem.class); final TreeListItem treeListItem2 = mock(TreeListItem.class); final TreeListItem treeListItem3 = mock(TreeListItem.class); when(treeListItem1.getDataSource()).thenReturn(do1); when(treeListItem2.getDataSource()).thenReturn(do2); when(treeListItem3.getDataSource()).thenReturn(do3); view.onSelectionChanged(Arrays.asList(treeListItem1, treeListItem2, treeListItem3)); verify(presenter).onDataObjectSelectionChanged(dataObjectsCaptor.capture()); final List<DataObject> values = dataObjectsCaptor.getValue(); assertEquals(3, values.size()); assertThat(values).containsExactly(do1, do2, do3); }
void onSelectionChanged(final List<TreeListItem> treeListItems) { final List<DataObject> selectedItems = treeListItems.stream() .map(item -> item.getDataSource()) .collect(Collectors.toList()); presenter.onDataObjectSelectionChanged(selectedItems); }
ImportDataObjectModalView implements ImportDataObjectModal.View { void onSelectionChanged(final List<TreeListItem> treeListItems) { final List<DataObject> selectedItems = treeListItems.stream() .map(item -> item.getDataSource()) .collect(Collectors.toList()); presenter.onDataObjectSelectionChanged(selectedItems); } }
ImportDataObjectModalView implements ImportDataObjectModal.View { void onSelectionChanged(final List<TreeListItem> treeListItems) { final List<DataObject> selectedItems = treeListItems.stream() .map(item -> item.getDataSource()) .collect(Collectors.toList()); presenter.onDataObjectSelectionChanged(selectedItems); } @Inject  ImportDataObjectModalView(final HTMLDivElement header,
                                     final HTMLDivElement body,
                                     final HTMLDivElement footer,
                                     final TreeList treeList,
                                     @Named("span") final HTMLElement noteText,
                                     final HTMLLabelElement noteLabel,
                                     final HTMLDivElement itemsContainer,
                                     final HTMLAnchorElement clearSelection,
                                     final ManagedInstance<TreeListItem> items,
                                     final HTMLButtonElement buttonImport,
                                     final HTMLButtonElement buttonCancel,
                                     final HTMLDivElement warningContainer); }
ImportDataObjectModalView implements ImportDataObjectModal.View { void onSelectionChanged(final List<TreeListItem> treeListItems) { final List<DataObject> selectedItems = treeListItems.stream() .map(item -> item.getDataSource()) .collect(Collectors.toList()); presenter.onDataObjectSelectionChanged(selectedItems); } @Inject  ImportDataObjectModalView(final HTMLDivElement header,
                                     final HTMLDivElement body,
                                     final HTMLDivElement footer,
                                     final TreeList treeList,
                                     @Named("span") final HTMLElement noteText,
                                     final HTMLLabelElement noteLabel,
                                     final HTMLDivElement itemsContainer,
                                     final HTMLAnchorElement clearSelection,
                                     final ManagedInstance<TreeListItem> items,
                                     final HTMLButtonElement buttonImport,
                                     final HTMLButtonElement buttonCancel,
                                     final HTMLDivElement warningContainer); @PostConstruct void setup(); @Override String getHeader(); @Override HTMLElement getBody(); @Override HTMLElement getFooter(); @Override void init(final ImportDataObjectModal presenter); @Override void addItems(final List<DataObject> dataObjects); @Override void clear(); @Override void showDataTypeWithSameNameWarning(); @Override void hideDataTypeWithSameNameWarning(); }
ImportDataObjectModalView implements ImportDataObjectModal.View { void onSelectionChanged(final List<TreeListItem> treeListItems) { final List<DataObject> selectedItems = treeListItems.stream() .map(item -> item.getDataSource()) .collect(Collectors.toList()); presenter.onDataObjectSelectionChanged(selectedItems); } @Inject  ImportDataObjectModalView(final HTMLDivElement header,
                                     final HTMLDivElement body,
                                     final HTMLDivElement footer,
                                     final TreeList treeList,
                                     @Named("span") final HTMLElement noteText,
                                     final HTMLLabelElement noteLabel,
                                     final HTMLDivElement itemsContainer,
                                     final HTMLAnchorElement clearSelection,
                                     final ManagedInstance<TreeListItem> items,
                                     final HTMLButtonElement buttonImport,
                                     final HTMLButtonElement buttonCancel,
                                     final HTMLDivElement warningContainer); @PostConstruct void setup(); @Override String getHeader(); @Override HTMLElement getBody(); @Override HTMLElement getFooter(); @Override void init(final ImportDataObjectModal presenter); @Override void addItems(final List<DataObject> dataObjects); @Override void clear(); @Override void showDataTypeWithSameNameWarning(); @Override void hideDataTypeWithSameNameWarning();  }