### Question:
ImportRecordEngine implements RecordEngine<BaseIncludedModelActiveRecord> { @Override public List<BaseIncludedModelActiveRecord> destroy(final BaseIncludedModelActiveRecord record) { definitionsHandler.destroy(record); drgElementHandlers.forEach(handler -> handler.destroy(record.getName())); stateProvider.getImports().remove(getImport(record)); return singletonList(record); } @Inject  ImportRecordEngine(final IncludedModelsPageStateProviderImpl stateProvider,
                              final IncludedModelsIndex includedModelsIndex,
                              final IncludedModelErrorMessageFactory messageFactory,
                              final ImportFactory importFactory,
                              final Event<FlashMessage> flashMessageEvent,
                              final DefinitionsHandler definitionsHandler,
                              final @Any ManagedInstance<DRGElementHandler> drgElementHandlers); @Override List<BaseIncludedModelActiveRecord> update(final BaseIncludedModelActiveRecord record); @Override List<BaseIncludedModelActiveRecord> destroy(final BaseIncludedModelActiveRecord record); @Override List<BaseIncludedModelActiveRecord> create(final BaseIncludedModelActiveRecord record); @Override boolean isValid(final BaseIncludedModelActiveRecord record);  }### Answer:
@Test public void testDestroy() { final BaseIncludedModelActiveRecord record = mock(BaseIncludedModelActiveRecord.class); final Import import1 = mock(Import.class); final Import import2 = mock(Import.class); final List<Import> expectedImports = singletonList(import1); final List<Import> actualImports = new ArrayList<>(asList(import1, import2)); final String name = "name"; when(record.getName()).thenReturn(name); when(includedModelsIndex.getImport(record)).thenReturn(import2); when(stateProvider.getImports()).thenReturn(actualImports); final List<BaseIncludedModelActiveRecord> actualResult = recordEngine.destroy(record); final List<BaseIncludedModelActiveRecord> expectedResult = singletonList(record); verify(definitionsHandler).destroy(record); verify(itemDefinitionHandler).destroy(name); verify(dmnIncludedModelHandler).destroy(name); verify(pmmlIncludedModelHandler).destroy(name); assertEquals(expectedImports, actualImports); assertEquals(expectedResult, actualResult); }