@Test public void testIsParentElementOnListWhenIsPresent() { final DataTypeListItem item = mock(DataTypeListItem.class); final HTMLElement element = mock(HTMLElement.class); final String id = "id"; when(element.getAttribute(UUID_ATTR)).thenReturn(id); when(item.getDragAndDropElement()).thenReturn(element); final List<DataTypeListItem> groupedElements = Arrays.asList(item); boolean isPresent = view.isParentElementOnList(groupedElements, id); assertTrue(isPresent); }
boolean isParentElementOnList(final List<DataTypeListItem> groupedElements, final String parentId) { return groupedElements.stream() .anyMatch(element -> Objects.equals(element.getDragAndDropElement().getAttribute(UUID_ATTR), parentId)); }
DataTypeSearchBarView implements DataTypeSearchBar.View { boolean isParentElementOnList(final List<DataTypeListItem> groupedElements, final String parentId) { return groupedElements.stream() .anyMatch(element -> Objects.equals(element.getDragAndDropElement().getAttribute(UUID_ATTR), parentId)); } }
DataTypeSearchBarView implements DataTypeSearchBar.View { boolean isParentElementOnList(final List<DataTypeListItem> groupedElements, final String parentId) { return groupedElements.stream() .anyMatch(element -> Objects.equals(element.getDragAndDropElement().getAttribute(UUID_ATTR), parentId)); } @Inject  DataTypeSearchBarView(final HTMLInputElement searchBar,
                                 final @Named("span") HTMLElement searchIcon,
                                 final HTMLButtonElement closeSearch,
                                 final TranslationService translationService); }
DataTypeSearchBarView implements DataTypeSearchBar.View { boolean isParentElementOnList(final List<DataTypeListItem> groupedElements, final String parentId) { return groupedElements.stream() .anyMatch(element -> Objects.equals(element.getDragAndDropElement().getAttribute(UUID_ATTR), parentId)); } @Inject  DataTypeSearchBarView(final HTMLInputElement searchBar,
                                 final @Named("span") HTMLElement searchIcon,
                                 final HTMLButtonElement closeSearch,
                                 final TranslationService translationService); @PostConstruct void setupSearchBar(); @Override void init(final DataTypeSearchBar presenter); @EventHandler("close-search") void onSearchBarCloseButton(final ClickEvent e); @EventHandler("search-bar") void onSearchBarKeyUpEvent(final KeyUpEvent event); @EventHandler("search-bar") void onSearchBarKeyDownEvent(final KeyDownEvent e); @EventHandler("search-bar") void onSearchBarChangeEvent(final ChangeEvent e); @Override void resetSearchBar(); @Override void showSearchResults(final List<DataType> results); void refreshItemsPosition(); }
DataTypeSearchBarView implements DataTypeSearchBar.View { boolean isParentElementOnList(final List<DataTypeListItem> groupedElements, final String parentId) { return groupedElements.stream() .anyMatch(element -> Objects.equals(element.getDragAndDropElement().getAttribute(UUID_ATTR), parentId)); } @Inject  DataTypeSearchBarView(final HTMLInputElement searchBar,
                                 final @Named("span") HTMLElement searchIcon,
                                 final HTMLButtonElement closeSearch,
                                 final TranslationService translationService); @PostConstruct void setupSearchBar(); @Override void init(final DataTypeSearchBar presenter); @EventHandler("close-search") void onSearchBarCloseButton(final ClickEvent e); @EventHandler("search-bar") void onSearchBarKeyUpEvent(final KeyUpEvent event); @EventHandler("search-bar") void onSearchBarKeyDownEvent(final KeyDownEvent e); @EventHandler("search-bar") void onSearchBarChangeEvent(final ChangeEvent e); @Override void resetSearchBar(); @Override void showSearchResults(final List<DataType> results); void refreshItemsPosition();  }