### Question:
DragAndDropHelper { void refreshItemsPosition() { final NodeList<Element> draggableItems = dragArea.querySelectorAll(DRAGGABLE_ITEM_CLASS); final int addButtonTop; if (!Objects.isNull(draggableItems) && draggableItems.length > 0) { final double itemHeight = getItemHeight((HTMLElement) draggableItems.getAt(0)); addButtonTop = (int) (draggableItems.length * itemHeight); for (int i = 0; i < draggableItems.length; i++) { final HTMLElement element = (HTMLElement) draggableItems.getAt(i); final int top = (int) (position(element) * itemHeight); setTop(element, top); } } else { addButtonTop = 0; } setTop(addButtonContainer, addButtonTop); } DragAndDropHelper(final HTMLElement dragArea,
                             final HTMLElement addButtonContainer);   }### Answer:
@Test public void testRefreshItemsPosition() { final HTMLElement element1 = mock(HTMLElement.class); final HTMLElement element2 = mock(HTMLElement.class); final HTMLElement element3 = mock(HTMLElement.class); final CSSStyleDeclaration element1Style = mock(CSSStyleDeclaration.class); final CSSStyleDeclaration element2Style = mock(CSSStyleDeclaration.class); final CSSStyleDeclaration element3Style = mock(CSSStyleDeclaration.class); element1.style = element1Style; element2.style = element2Style; element3.style = element3Style; element1.offsetHeight = 50; final NodeList<Element> draggableItems = spy(new NodeList<>()); doReturn(element1).when(draggableItems).getAt(0); doReturn(element2).when(draggableItems).getAt(1); doReturn(element3).when(draggableItems).getAt(2); when(element1.getAttribute(DATA_POSITION)).thenReturn("0"); when(element2.getAttribute(DATA_POSITION)).thenReturn("1"); when(element3.getAttribute(DATA_POSITION)).thenReturn("2"); draggableItems.length = 3; when(dragArea.querySelectorAll(DragAndDropHelper.DRAGGABLE_ITEM_CLASS)).thenReturn(draggableItems); helper.refreshItemsPosition(); verify(element1Style).setProperty(TOP, 0 + PX); verify(element2Style).setProperty(TOP, 50 + PX); verify(element3Style).setProperty(TOP, 100 + PX); verify(addButtonContainerStyle).setProperty(TOP, 150 + PX); }