### Question:
DNDListComponentView implements DNDListComponent.View { boolean hasChildren(final Element element) { final Element next = getNextElement(element, nextElement -> { final boolean isNotDragging = !Objects.equals(nextElement, getDragging()); final boolean isNotDependentElement = !getDependentElements().contains(nextElement); return isNotDragging && isNotDependentElement; }); if (next == null) { return false; } final int currentPositionX = Position.getX(element); final int nextPositionX = Position.getX(next); return currentPositionX == nextPositionX - 1; } @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 testHasChildrenWhenElementDoesNotHaveChildren() { final HTMLElement currentElement = mock(HTMLElement.class); final HTMLElement nextElement = mock(HTMLElement.class); when(dragArea.querySelector(".kie-dnd-draggable[data-y-position=\"1\"]")).thenReturn(nextElement); when(currentElement.getAttribute(DATA_Y_POSITION)).thenReturn("0"); when(nextElement.getAttribute(DATA_Y_POSITION)).thenReturn("1"); when(currentElement.getAttribute(DATA_X_POSITION)).thenReturn("0"); when(nextElement.getAttribute(DATA_X_POSITION)).thenReturn("0"); assertFalse(view.hasChildren(currentElement)); }
@Test public void testHasChildrenWhenNextElementIsNull() { final HTMLElement currentElement = mock(HTMLElement.class); when(dragArea.querySelector(".kie-dnd-draggable[data-y-position=\"1\"]")).thenReturn(null); when(currentElement.getAttribute(DATA_Y_POSITION)).thenReturn("0"); when(currentElement.getAttribute(DATA_X_POSITION)).thenReturn("0"); assertFalse(view.hasChildren(currentElement)); }