use of org.kie.workbench.common.dmn.backend.editors.types.exceptions.DMNIncludeModelCouldNotBeCreatedException in project kie-wb-common by kiegroup.
the class DMNIncludedModelsServiceImplTest method testLoadModelsWhenWorkspaceProjectIsNotNull.
@Test
public void testLoadModelsWhenWorkspaceProjectIsNotNull() throws Exception {
final WorkspaceProject workspaceProject = mock(WorkspaceProject.class);
final Path rootPath = mock(Path.class);
final String uri = "/src/path/file.dmn";
final Path path1 = mock(Path.class);
final Path path2 = mock(Path.class);
final Path path3 = mock(Path.class);
final IncludedModel includedModel1 = mock(IncludedModel.class);
final IncludedModel includedModel2 = mock(IncludedModel.class);
when(workspaceProject.getRootPath()).thenReturn(rootPath);
when(rootPath.toURI()).thenReturn(uri);
when(pathsHelper.getModelsPaths(workspaceProject)).thenReturn(asList(path1, path2, path3));
when(includedModelFactory.create(dmnModelPath, path1)).thenReturn(includedModel1);
when(includedModelFactory.create(dmnModelPath, path2)).thenReturn(includedModel2);
when(includedModelFactory.create(dmnModelPath, path3)).thenThrow(new DMNIncludeModelCouldNotBeCreatedException());
final List<IncludedModel> includedModels = service.loadModels(dmnModelPath, workspaceProject);
assertEquals(2, includedModels.size());
assertEquals(includedModel1, includedModels.get(0));
assertEquals(includedModel2, includedModels.get(1));
}
use of org.kie.workbench.common.dmn.backend.editors.types.exceptions.DMNIncludeModelCouldNotBeCreatedException in project kie-wb-common by kiegroup.
the class DMNIncludedModelsServiceImplTest method testLoadModelsWhenWorkspaceProjectIsNull.
@Test
public void testLoadModelsWhenWorkspaceProjectIsNull() throws Exception {
final WorkspaceProject workspaceProject = null;
final Path path1 = mock(Path.class);
final Path path2 = mock(Path.class);
final Path path3 = mock(Path.class);
final IncludedModel includedModel1 = mock(IncludedModel.class);
final IncludedModel includedModel2 = mock(IncludedModel.class);
when(pathsHelper.getModelsPaths(workspaceProject)).thenReturn(asList(path1, path2, path3));
when(includedModelFactory.create(dmnModelPath, path1)).thenReturn(includedModel1);
when(includedModelFactory.create(dmnModelPath, path2)).thenReturn(includedModel2);
when(includedModelFactory.create(dmnModelPath, path3)).thenThrow(new DMNIncludeModelCouldNotBeCreatedException());
final List<IncludedModel> includedModels = service.loadModels(dmnModelPath, workspaceProject);
assertEquals(2, includedModels.size());
assertEquals(includedModel1, includedModels.get(0));
assertEquals(includedModel2, includedModels.get(1));
}
Aggregations