### Question:
DataTypeSearchBar { List<DataTypeListItem> getDataTypeListItemsSortedByPositionY() { return getDataTypeListItems() .stream() .sorted(Comparator.comparing(item -> getDNDListComponent().getPositionY(item.getDragAndDropElement()))) .collect(Collectors.toList()); } @Inject  DataTypeSearchBar(final View view,
                             final DataTypeSearchEngine searchEngine,
                             final DataTypeList dataTypeList); HTMLElement getElement(); void refresh(); void reset(); boolean isEnabled();  }### Answer:
@Test public void testGetDataTypeListItemsSortedByPositionY() { final DataTypeListItem list0 = mock(DataTypeListItem.class); final DataTypeListItem list1 = mock(DataTypeListItem.class); final HTMLElement element0 = mock(HTMLElement.class); final HTMLElement element1 = mock(HTMLElement.class); final DNDListComponent dndListComponent = mock(DNDListComponent.class); final Integer positionY0 = 3; final Integer positionY1 = 2; final Map<String, Integer> store = new HashMap<>(); when(dndListComponent.getPositionY(element0)).thenReturn(positionY0); when(dndListComponent.getPositionY(element1)).thenReturn(positionY1); when(list0.getDragAndDropElement()).thenReturn(element0); when(list1.getDragAndDropElement()).thenReturn(element1); when(dataTypeList.getItems()).thenReturn(asList(list0, list1)); when(dataTypeList.getDNDListComponent()).thenReturn(dndListComponent); doReturn(store).when(searchBar).getDataTypeListPositionsStore(); final List<DataTypeListItem> actualListItems = searchBar.getDataTypeListItemsSortedByPositionY(); final List<DataTypeListItem> expectedListItems = asList(list1, list0); assertEquals(expectedListItems, actualListItems); }