@Test public void testCollapseItemsInTheFirstLevel() { final DataTypeListItem listItem1 = mock(DataTypeListItem.class); final DataTypeListItem listItem2 = mock(DataTypeListItem.class); final DataTypeListItem listItem3 = mock(DataTypeListItem.class); final DataTypeListItem listItem4 = mock(DataTypeListItem.class); final List<DataTypeListItem> listItems = asList(listItem1, listItem2, listItem3, listItem4); when(listItem1.getLevel()).thenReturn(1); when(listItem2.getLevel()).thenReturn(2); when(listItem3.getLevel()).thenReturn(1); when(listItem4.getLevel()).thenReturn(2); doReturn(listItems).when(dataTypeList).getItems(); dataTypeList.collapseItemsInTheFirstLevel(); verify(listItem1).collapse(); verify(listItem2, never()).collapse(); verify(listItem3).collapse(); verify(listItem4, never()).collapse(); }
void collapseItemsInTheFirstLevel() { getItems() .stream() .filter(typeListItem -> typeListItem.getLevel() == 1) .forEach(DataTypeListItem::collapse); }
DataTypeList { void collapseItemsInTheFirstLevel() { getItems() .stream() .filter(typeListItem -> typeListItem.getLevel() == 1) .forEach(DataTypeListItem::collapse); } }
DataTypeList { void collapseItemsInTheFirstLevel() { getItems() .stream() .filter(typeListItem -> typeListItem.getLevel() == 1) .forEach(DataTypeListItem::collapse); } @Inject  DataTypeList(final View view,
                        final ManagedInstance<DataTypeListItem> listItems,
                        final DataTypeManager dataTypeManager,
                        final DataTypeSearchBar searchBar,
                        final DNDListComponent dndListComponent,
                        final DataTypeStackHash dataTypeStackHash,
                        final DNDDataTypesHandler dndDataTypesHandler,
                        final DataTypeListHighlightHelper highlightHelper,
                        final IsKogito isKogito); }
DataTypeList { void collapseItemsInTheFirstLevel() { getItems() .stream() .filter(typeListItem -> typeListItem.getLevel() == 1) .forEach(DataTypeListItem::collapse); } @Inject  DataTypeList(final View view,
                        final ManagedInstance<DataTypeListItem> listItems,
                        final DataTypeManager dataTypeManager,
                        final DataTypeSearchBar searchBar,
                        final DNDListComponent dndListComponent,
                        final DataTypeStackHash dataTypeStackHash,
                        final DNDDataTypesHandler dndDataTypesHandler,
                        final DataTypeListHighlightHelper highlightHelper,
                        final IsKogito isKogito); HTMLElement getElement(); void setupItems(final List<DataType> dataTypes); Optional<DataTypeListItem> findItem(final DataType dataType); DNDListComponent getDNDListComponent(); List<DataTypeListItem> getItems(); void showNoDataTypesFound(); void showListItems(); void collapseAll(); void enableEditMode(final String dataTypeHash); void registerDataTypeListItemUpdateCallback(final Consumer<DataTypeListItem> onDataTypeListItemUpdate); Optional<DataTypeListItem> findItemByDataTypeHash(final String dataTypeHash); String calculateHash(final DataType dataType); void onDataTypeEditModeToggle(final @Observes DataTypeEditModeToggleEvent event); HTMLElement getListItems(); void importDataObjects(final List<DataObject> selectedDataObjects); void disableEditModeForChildren(final DataTypeListItem dataTypeListItem); List<String> getExistingDataTypesNames(); void highlightLevel(final DataType dataType); void highlightLevel(final Element element); void highlight(final Element element); void cleanLevelHighlightClass(); void cleanHighlightClass(); }
DataTypeList { void collapseItemsInTheFirstLevel() { getItems() .stream() .filter(typeListItem -> typeListItem.getLevel() == 1) .forEach(DataTypeListItem::collapse); } @Inject  DataTypeList(final View view,
                        final ManagedInstance<DataTypeListItem> listItems,
                        final DataTypeManager dataTypeManager,
                        final DataTypeSearchBar searchBar,
                        final DNDListComponent dndListComponent,
                        final DataTypeStackHash dataTypeStackHash,
                        final DNDDataTypesHandler dndDataTypesHandler,
                        final DataTypeListHighlightHelper highlightHelper,
                        final IsKogito isKogito); HTMLElement getElement(); void setupItems(final List<DataType> dataTypes); Optional<DataTypeListItem> findItem(final DataType dataType); DNDListComponent getDNDListComponent(); List<DataTypeListItem> getItems(); void showNoDataTypesFound(); void showListItems(); void collapseAll(); void enableEditMode(final String dataTypeHash); void registerDataTypeListItemUpdateCallback(final Consumer<DataTypeListItem> onDataTypeListItemUpdate); Optional<DataTypeListItem> findItemByDataTypeHash(final String dataTypeHash); String calculateHash(final DataType dataType); void onDataTypeEditModeToggle(final @Observes DataTypeEditModeToggleEvent event); HTMLElement getListItems(); void importDataObjects(final List<DataObject> selectedDataObjects); void disableEditModeForChildren(final DataTypeListItem dataTypeListItem); List<String> getExistingDataTypesNames(); void highlightLevel(final DataType dataType); void highlightLevel(final Element element); void highlight(final Element element); void cleanLevelHighlightClass(); void cleanHighlightClass();  }