### Question:
ImportFactory { public Import makeImport(final BaseIncludedModelActiveRecord record) { Import anImport; if (record instanceof DMNIncludedModelActiveRecord) { final ImportDMN dmn = new ImportDMN(); final DMNIncludedModelActiveRecord dmnRecord = (DMNIncludedModelActiveRecord) record; dmn.setName(name(record)); dmn.setNamespace(record.getNamespace()); dmn.setLocationURI(location(record)); dmn.setImportType(record.getImportType()); dmn.setDrgElementsCount(dmnRecord.getDrgElementsCount()); dmn.setItemDefinitionsCount(dmnRecord.getDataTypesCount()); anImport = dmn; } else if (record instanceof PMMLIncludedModelActiveRecord) { final ImportPMML pmml = new ImportPMML(); final PMMLIncludedModelActiveRecord pmmlRecord = (PMMLIncludedModelActiveRecord) record; pmml.setName(name(record)); pmml.setNamespace(name(record).getValue()); pmml.setLocationURI(location(record)); pmml.setImportType(record.getImportType()); pmml.setModelCount(pmmlRecord.getModelCount()); anImport = pmml; } else { anImport = new Import(); } anImport.setLocationURI(location(record)); anImport.setImportType(record.getImportType()); return anImport; } @Inject  ImportFactory(final IncludedModelsIndex modelsIndex); Import makeImport(final BaseIncludedModelActiveRecord record);  }### Answer:
@Test public void testMakeDMNImport() { final DMNIncludedModelActiveRecord record = new DMNIncludedModelActiveRecord(null); final String expectedImportType = DMNImportTypes.DMN.getDefaultNamespace(); final String nameValue = "name"; final String path = "/src/main/kie/dmn"; final Name expectedName = new Name(nameValue); final LocationURI expectedLocationURI = new LocationURI(path); final String expectedNamespace = ": final int expectedDrgElementsCount = 2; final int expectedItemDefinitionsCount = 3; record.setName(nameValue); record.setPath(path); record.setNamespace(expectedNamespace); record.setImportType(DMNImportTypes.DMN.getDefaultNamespace()); record.setDrgElementsCount(expectedDrgElementsCount); record.setDataTypesCount(expectedItemDefinitionsCount); final Import actualImport = factory.makeImport(record); assertTrue(actualImport instanceof ImportDMN); final ImportDMN dmnImport = (ImportDMN) actualImport; assertEquals(expectedImportType, actualImport.getImportType()); assertEquals(expectedName, actualImport.getName()); assertEquals(expectedLocationURI, actualImport.getLocationURI()); assertEquals(expectedNamespace, actualImport.getNamespace()); assertEquals(expectedImportType, actualImport.getImportType()); assertEquals(expectedDrgElementsCount, dmnImport.getDrgElementsCount()); assertEquals(expectedItemDefinitionsCount, dmnImport.getItemDefinitionsCount()); }
@Test public void testMakePMMLImport() { final PMMLIncludedModelActiveRecord record = new PMMLIncludedModelActiveRecord(null); final String expectedImportType = DMNImportTypes.PMML.getDefaultNamespace(); final String expectedNameValue = "name"; final String path = "/src/main/kie/pmml"; final Name expectedName = new Name(expectedNameValue); final LocationURI expectedLocationURI = new LocationURI(path); final int expectedModelCount = 2; record.setPath(path); record.setName(expectedNameValue); record.setNamespace(expectedNameValue); record.setImportType(DMNImportTypes.PMML.getDefaultNamespace()); record.setModelCount(expectedModelCount); final Import actualImport = factory.makeImport(record); assertTrue(actualImport instanceof ImportPMML); final ImportPMML pmmlImport = (ImportPMML) actualImport; assertEquals(expectedImportType, actualImport.getImportType()); assertEquals(expectedName, actualImport.getName()); assertEquals(expectedLocationURI, actualImport.getLocationURI()); assertEquals(expectedNameValue, actualImport.getNamespace()); assertEquals(expectedImportType, actualImport.getImportType()); assertEquals(expectedModelCount, pmmlImport.getModelCount()); }