### Question:
DataTypeDestroyHandler extends DataTypeHandler { public void destroy(final DataType dataType) { final Optional<DataType> dataTypeParent = Optional.ofNullable(parent(dataType)); dataTypeParent.ifPresent(parent -> { parent.getSubDataTypes().remove(dataType); }); unIndex(dataType); } @Inject  DataTypeDestroyHandler(final DataTypeStore dataTypeStore,
                                  final DataTypeManager dataTypeManager); void destroy(final DataType dataType); List<DataType> refreshDependentDataTypes(final DataType dataType);  }### Answer:
@Test public void testDestroy() { final String uuid = "uuid"; final String parentUUID = "parentUUID"; final String childUUID1 = "childUUID1"; final String childUUID2 = "childUUID2"; final String grandchildUUID1 = "grandchildUUID1"; final String grandchildUUID2 = "grandchildUUID2"; final DataType[] grandchildren = {makeDataType(grandchildUUID1), makeDataType(grandchildUUID2)}; final DataType[] children = {makeDataType(childUUID1), makeDataType(childUUID2, grandchildren)}; final DataType dataType = makeDataType(uuid, children); final DataType parent = makeDataType(parentUUID, dataType); doReturn(parent).when(handler).parent(dataType); handler.destroy(dataType); verify(dataTypeStore).unIndex(uuid); verify(dataTypeStore).unIndex(childUUID1); verify(dataTypeStore).unIndex(childUUID2); verify(dataTypeStore).unIndex(grandchildUUID1); verify(dataTypeStore).unIndex(grandchildUUID2); assertEquals(emptyList(), parent.getSubDataTypes()); }