### Question:
ProjectDiagramServiceController extends AbstractVFSDiagramService<ProjectMetadata, ProjectDiagram> { @Override public ProjectDiagram getDiagramByPath(Path file) { final ProjectDiagram projectDiagram = super.getDiagramByPath(file); final org.uberfire.java.nio.file.Path svgPath = getDiagramSvgFilePath(projectDiagram); if (getIoService().exists(svgPath)) { projectDiagram.getMetadata().setDiagramSVGPath(Paths.convert(svgPath)); final String svgContent = getIoService().readAllString(svgPath); if (svgContent != null && svgContent.contains("xmlns:oryx=\"http: projectDiagram.getMetadata().setDiagramSVGGenerator(ProjectMetadata.SVGGenerator.JBPM_DESIGNER); } else { projectDiagram.getMetadata().setDiagramSVGGenerator(ProjectMetadata.SVGGenerator.STUNNER); } } return projectDiagram; } ProjectDiagramServiceController(final DefinitionManager definitionManager,
                                    final FactoryManager factoryManager,
                                    final Instance<DefinitionSetService> definitionSetServiceInstances,
                                    final IOService ioService,
                                    final BackendRegistryFactory registryFactory,
                                    final KieModuleService moduleService,
                                    final KieServiceOverviewLoader overviewLoader,
                                    final User identity); @Override Path create(final Path path,
                       final String name,
                       final String defSetId); Path create(final Path path,
                       final String name,
                       final String defSetId,
                       final String moduleName,
                       final Package projectPkg,
                       final Optional<String> projectType); @Override ProjectDiagram getDiagramByPath(Path file); Path save(final Path path,
                     final ProjectDiagram diagram,
                     final Map<String, ?> attributes,
                     final OpenOption... comment); Path saveAsXml(final Path path,
                          final String xml,
                          final Map<String, ?> attributes,
                          final OpenOption... comment); boolean delete(final Path _path,
                          final String message);  }### Answer:
@Test @Override public void testGetDiagramByPath() throws IOException { final Path path = mockGetDiagramByPathObjects(); prepareLoadDiagramByPath(path); final Diagram result = diagramService.getDiagramByPath(path); assertEquals(diagram, result); verifyExpectedResult(path, result, null, null); }
@Test public void testGetDiagramByPathWhenStunnerSVGFileExists() throws IOException { final Path path = mockGetDiagramByPathObjects(); final Path expectedSVGPath = prepareSVGFile(path, DIAGRAM_SVG); prepareLoadDiagramByPath(path); final Diagram result = diagramService.getDiagramByPath(path); assertEquals(diagram, result); verifyExpectedResult(path, result, expectedSVGPath, ProjectMetadata.SVGGenerator.STUNNER); }
@Test public void testGetDiagramByPathWhenStunnerJBPMFileExists() throws IOException { final Path path = mockGetDiagramByPathObjects(); final Path expectedSVGPath = prepareSVGFile(path, JBPM_DIAGRAM_SVG); prepareLoadDiagramByPath(path); final Diagram result = diagramService.getDiagramByPath(path); assertEquals(diagram, result); verifyExpectedResult(path, result, expectedSVGPath, ProjectMetadata.SVGGenerator.JBPM_DESIGNER); }