### Question:
DNDListComponentView implements DNDListComponent.View { void fixChildrenPosition(final int minimalXPosition, final int numberOfExtraLevels, final List<HTMLElement> children) { for (int i = 0; i < children.size(); i++) { final HTMLElement dependentElement = children.get(i); final int elementPosition = Position.getX(dependentElement); final boolean isElementPositionValid = i > 0 && elementPosition >= Position.getX(children.get(i - 1)); if (!isElementPositionValid) { final int positionX = elementPosition - numberOfExtraLevels; final int newElementPosition = positionX < minimalXPosition ? minimalXPosition : positionX; Position.setX(dependentElement, newElementPosition); } } } @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 testFixChildrenPosition() { final HTMLElement dependentElement0 = mock(HTMLElement.class); final HTMLElement dependentElement1 = mock(HTMLElement.class); final HTMLElement dependentElement2 = mock(HTMLElement.class); final int minimalXPosition = 4; final int numberOfExtraLevels = 6; final List<HTMLElement> children = asList(dependentElement0, dependentElement1, dependentElement2); when(dependentElement0.getAttribute(DATA_X_POSITION)).thenReturn("8"); when(dependentElement1.getAttribute(DATA_X_POSITION)).thenReturn("2"); when(dependentElement2.getAttribute(DATA_X_POSITION)).thenReturn("5"); view.fixChildrenPosition(minimalXPosition, numberOfExtraLevels, children); verify(dependentElement0).setAttribute(DATA_X_POSITION, 4); verify(dependentElement1).setAttribute(DATA_X_POSITION, 4); }