### Question:
DNDDataTypesHandler { public void onDropDataType(final Element currentElement, final Element hoverElement) { try { final DNDDataTypesHandlerContext dndContext = makeDndContext(currentElement, hoverElement); final Optional<DataType> current = dndContext.getCurrentDataType(); final Optional<DataType> reference = dndContext.getReference(); if (current.isPresent() && reference.isPresent()) { shiftCurrentByReference(current.get(), reference.get(), dndContext.getStrategy()); } } catch (final Exception e) { logError("Drag-n-Drop error (" + e.getMessage() + "). Check '" + DNDDataTypesHandler.class.getSimpleName() + "'."); } } @Inject  DNDDataTypesHandler(final DataTypeStore dataTypeStore,
                               final DataTypeManager dataTypeManager,
                               final ItemDefinitionStore itemDefinitionStore); void init(final DataTypeList dataTypeList); void onDropDataType(final Element currentElement,
                               final Element hoverElement); void deleteKeepingReferences(final DataType existing);  }### Answer:
@Test public void testOnDropDataType() { final Element currentElement = mock(Element.class); final Element hoverElement = mock(Element.class); final DataType current = mock(DataType.class); final DataType reference = mock(DataType.class); final DNDDataTypesHandlerContext context = mock(DNDDataTypesHandlerContext.class); final DNDDataTypesHandlerShiftStrategy strategy = INSERT_INTO_HOVERED_DATA_TYPE; doNothing().when(handler).logError(anyString()); doReturn(context).when(handler).makeDndContext(currentElement, hoverElement); when(context.getCurrentDataType()).thenReturn(Optional.of(current)); when(context.getReference()).thenReturn(Optional.of(reference)); when(context.getStrategy()).thenReturn(strategy); handler.onDropDataType(currentElement, hoverElement); verify(handler).shiftCurrentByReference(current, reference, strategy); }