### Question:
DNDListComponentView implements DNDListComponent.View { @Override public void consolidateYPosition() { final List<HTMLElement> draggableElements = querySelector(getDragArea()).getVisibleAndSortedDraggableElements(); for (int i = 0; i < draggableElements.size(); i++) { Position.setY(draggableElements.get(i), i); } } @Inject  DNDListComponentView(final HTMLDivElement dragArea); @Override void init(final DNDListComponent presenter); @Override HTMLElement registerItem(final HTMLElement htmlElement); @Override void refreshItemsPosition(); @Override void refreshItemsHTML(); @Override void consolidateHierarchicalLevel(final boolean isElementsDraggedByUser); @Override void consolidateYPosition(); @Override void clear(); @Override Optional<HTMLElement> getPreviousElement(final Element reference); @Override void refreshDragAreaSize(); @Override HTMLDivElement getDragArea();  }### Answer:
@Test public void testConsolidateYPosition() { final HTMLElement element0 = mock(HTMLElement.class); final HTMLElement element1 = mock(HTMLElement.class); element0.style = mock(CSSStyleDeclaration.class); element1.style = mock(CSSStyleDeclaration.class); dragArea.style = mock(CSSStyleDeclaration.class); when(element0.getAttribute(DATA_Y_POSITION)).thenReturn("0"); when(element1.getAttribute(DATA_Y_POSITION)).thenReturn("2"); mockDragAreaWithChildren(element0, element1); view.consolidateYPosition(); verify(element0).setAttribute(DATA_Y_POSITION, 0); verify(element1).setAttribute(DATA_Y_POSITION, 1); }