@Test public void testSwapElements() { final Element a = mock(Element.class); final Element b = mock(Element.class); doReturn(2).when(helper).position(a); doReturn(1).when(helper).position(b); doNothing().when(helper).refreshItemsPosition(); helper.swapElements(a, b); verify(a).setAttribute(DATA_POSITION, 1); verify(b).setAttribute(DATA_POSITION, 2); }
void swapElements(final Element element, final Element element2) { if (Objects.isNull(element) || Objects.isNull(element2)) { return; } final int pos1 = position(element); final int pos2 = position(element2); element.setAttribute(DATA_POSITION, pos2); element2.setAttribute(DATA_POSITION, pos1); refreshItemsPosition(); }
DragAndDropHelper { void swapElements(final Element element, final Element element2) { if (Objects.isNull(element) || Objects.isNull(element2)) { return; } final int pos1 = position(element); final int pos2 = position(element2); element.setAttribute(DATA_POSITION, pos2); element2.setAttribute(DATA_POSITION, pos1); refreshItemsPosition(); } }
DragAndDropHelper { void swapElements(final Element element, final Element element2) { if (Objects.isNull(element) || Objects.isNull(element2)) { return; } final int pos1 = position(element); final int pos2 = position(element2); element.setAttribute(DATA_POSITION, pos2); element2.setAttribute(DATA_POSITION, pos1); refreshItemsPosition(); } DragAndDropHelper(final HTMLElement dragArea,
                             final HTMLElement addButtonContainer); }
DragAndDropHelper { void swapElements(final Element element, final Element element2) { if (Objects.isNull(element) || Objects.isNull(element2)) { return; } final int pos1 = position(element); final int pos2 = position(element2); element.setAttribute(DATA_POSITION, pos2); element2.setAttribute(DATA_POSITION, pos1); refreshItemsPosition(); } DragAndDropHelper(final HTMLElement dragArea,
                             final HTMLElement addButtonContainer);  }
DragAndDropHelper { void swapElements(final Element element, final Element element2) { if (Objects.isNull(element) || Objects.isNull(element2)) { return; } final int pos1 = position(element); final int pos2 = position(element2); element.setAttribute(DATA_POSITION, pos2); element2.setAttribute(DATA_POSITION, pos1); refreshItemsPosition(); } DragAndDropHelper(final HTMLElement dragArea,
                             final HTMLElement addButtonContainer);   }