@Test public void testGetSelectedItems() { final TreeListItem listItem1 = mock(TreeListItem.class); final DataObject dataObject1 = mock(DataObject.class); final TreeListItem listItem2 = mock(TreeListItem.class); final DataObject dataObject2 = mock(DataObject.class); when(listItem1.getDataSource()).thenReturn(dataObject1); when(listItem2.getDataSource()).thenReturn(dataObject2); final List<TreeListItem> selectedItems = Arrays.asList(listItem1, listItem2); when(treeList.getSelectedItems()).thenReturn(selectedItems); final List<DataObject> actual = view.getSelectedItems(); assertEquals(2, actual.size()); assertTrue(actual.contains(dataObject1)); assertTrue(actual.contains(dataObject2)); }
List<DataObject> getSelectedItems() { return treeList.getSelectedItems().stream() .map(item -> item.getDataSource()) .collect(Collectors.toList()); }
ImportDataObjectModalView implements ImportDataObjectModal.View { List<DataObject> getSelectedItems() { return treeList.getSelectedItems().stream() .map(item -> item.getDataSource()) .collect(Collectors.toList()); } }
ImportDataObjectModalView implements ImportDataObjectModal.View { List<DataObject> getSelectedItems() { return treeList.getSelectedItems().stream() .map(item -> item.getDataSource()) .collect(Collectors.toList()); } @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 { List<DataObject> getSelectedItems() { return treeList.getSelectedItems().stream() .map(item -> item.getDataSource()) .collect(Collectors.toList()); } @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 { List<DataObject> getSelectedItems() { return treeList.getSelectedItems().stream() .map(item -> item.getDataSource()) .collect(Collectors.toList()); } @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();  }