### Question:
DNDDataTypesHandler { boolean isTopLevelShiftOperation(final DataType dataType, final DNDDataTypesHandlerShiftStrategy shiftStrategy) { final boolean isCurrentTopLevel = dataType.isTopLevel(); final boolean isTopLevelShiftStrategy = shiftStrategy == INSERT_TOP_LEVEL_DATA_TYPE_AT_THE_TOP || shiftStrategy == INSERT_TOP_LEVEL_DATA_TYPE; return isCurrentTopLevel && isTopLevelShiftStrategy; } @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 testIsTopLevelShiftOperationWhenDataTypeIsNotTopLevel() { final DataType dataType = mock(DataType.class); final DNDDataTypesHandlerShiftStrategy shiftStrategy = INSERT_TOP_LEVEL_DATA_TYPE_AT_THE_TOP; when(dataType.isTopLevel()).thenReturn(false); assertFalse(handler.isTopLevelShiftOperation(dataType, shiftStrategy)); }
@Test public void testIsTopLevelShiftOperationWhenDataTypeIsTopLevelAndShiftStrategyIsNotTopLevel() { final DataType dataType = mock(DataType.class); when(dataType.isTopLevel()).thenReturn(true); assertFalse(handler.isTopLevelShiftOperation(dataType, INSERT_NESTED_DATA_TYPE)); assertFalse(handler.isTopLevelShiftOperation(dataType, INSERT_SIBLING_DATA_TYPE)); assertFalse(handler.isTopLevelShiftOperation(dataType, INSERT_INTO_HOVERED_DATA_TYPE)); }
@Test public void testIsTopLevelShiftOperationWhenDataTypeIsTopLevelAndShiftStrategyIsTopLevel() { final DataType dataType = mock(DataType.class); when(dataType.isTopLevel()).thenReturn(true); assertTrue(handler.isTopLevelShiftOperation(dataType, INSERT_TOP_LEVEL_DATA_TYPE_AT_THE_TOP)); assertTrue(handler.isTopLevelShiftOperation(dataType, INSERT_TOP_LEVEL_DATA_TYPE)); }