@Test(expected = DMNIncludeModelCouldNotBeCreatedException.class) public void testCreateUnknownIncludeRaisesAnError() throws Exception { when(importTypesHelper.isDMN(includedModelPath)).thenReturn(false); when(importTypesHelper.isPMML(includedModelPath)).thenReturn(false); factory.create(dmnModelPath, includedModelPath); }
public IncludedModel create(final Path dmnModelPath, final Path includedModelPath) throws DMNIncludeModelCouldNotBeCreatedException { try { if (importTypesHelper.isDMN(includedModelPath)) { return makeDMNIncludedModel(dmnModelPath, includedModelPath); } else if (importTypesHelper.isPMML(includedModelPath)) { return makePMMLIncludedModel(dmnModelPath, includedModelPath); } else { throw new IllegalArgumentException("Unsupported external model type."); } } catch (final Exception e) { throw new DMNIncludeModelCouldNotBeCreatedException(); } }
IncludedModelFactory { public IncludedModel create(final Path dmnModelPath, final Path includedModelPath) throws DMNIncludeModelCouldNotBeCreatedException { try { if (importTypesHelper.isDMN(includedModelPath)) { return makeDMNIncludedModel(dmnModelPath, includedModelPath); } else if (importTypesHelper.isPMML(includedModelPath)) { return makePMMLIncludedModel(dmnModelPath, includedModelPath); } else { throw new IllegalArgumentException("Unsupported external model type."); } } catch (final Exception e) { throw new DMNIncludeModelCouldNotBeCreatedException(); } } }
IncludedModelFactory { public IncludedModel create(final Path dmnModelPath, final Path includedModelPath) throws DMNIncludeModelCouldNotBeCreatedException { try { if (importTypesHelper.isDMN(includedModelPath)) { return makeDMNIncludedModel(dmnModelPath, includedModelPath); } else if (importTypesHelper.isPMML(includedModelPath)) { return makePMMLIncludedModel(dmnModelPath, includedModelPath); } else { throw new IllegalArgumentException("Unsupported external model type."); } } catch (final Exception e) { throw new DMNIncludeModelCouldNotBeCreatedException(); } } @Inject  IncludedModelFactory(final DMNDiagramHelper diagramHelper,
                                final DMNPathsHelper pathsHelper,
                                final DMNImportTypesHelper importTypesHelper,
                                final PMMLIncludedDocumentFactory pmmlDocumentFactory,
                                final KieModuleService moduleService); }
IncludedModelFactory { public IncludedModel create(final Path dmnModelPath, final Path includedModelPath) throws DMNIncludeModelCouldNotBeCreatedException { try { if (importTypesHelper.isDMN(includedModelPath)) { return makeDMNIncludedModel(dmnModelPath, includedModelPath); } else if (importTypesHelper.isPMML(includedModelPath)) { return makePMMLIncludedModel(dmnModelPath, includedModelPath); } else { throw new IllegalArgumentException("Unsupported external model type."); } } catch (final Exception e) { throw new DMNIncludeModelCouldNotBeCreatedException(); } } @Inject  IncludedModelFactory(final DMNDiagramHelper diagramHelper,
                                final DMNPathsHelper pathsHelper,
                                final DMNImportTypesHelper importTypesHelper,
                                final PMMLIncludedDocumentFactory pmmlDocumentFactory,
                                final KieModuleService moduleService); IncludedModel create(final Path dmnModelPath,
                                final Path includedModelPath); }
IncludedModelFactory { public IncludedModel create(final Path dmnModelPath, final Path includedModelPath) throws DMNIncludeModelCouldNotBeCreatedException { try { if (importTypesHelper.isDMN(includedModelPath)) { return makeDMNIncludedModel(dmnModelPath, includedModelPath); } else if (importTypesHelper.isPMML(includedModelPath)) { return makePMMLIncludedModel(dmnModelPath, includedModelPath); } else { throw new IllegalArgumentException("Unsupported external model type."); } } catch (final Exception e) { throw new DMNIncludeModelCouldNotBeCreatedException(); } } @Inject  IncludedModelFactory(final DMNDiagramHelper diagramHelper,
                                final DMNPathsHelper pathsHelper,
                                final DMNImportTypesHelper importTypesHelper,
                                final PMMLIncludedDocumentFactory pmmlDocumentFactory,
                                final KieModuleService moduleService); IncludedModel create(final Path dmnModelPath,
                                final Path includedModelPath);  }