### Question:
ProjectDiagramServiceController extends AbstractVFSDiagramService<ProjectMetadata, ProjectDiagram> { public Path saveAsXml(final Path path, final String xml, final Map<String, ?> attributes, final OpenOption... comment) { try { getIoService().write(Paths.convert(path), xml, attributes, comment); } catch (Exception e) { LOG.error("Error while saving diagram.", e); throw new RuntimeException(e); } return path; } 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 public void testSaveAsXml() { final Path path = mock(Path.class); final String xml = "xml"; final Map<String, ?> attributes = Collections.singletonMap("key", "value"); final CommentedOption option = mock(CommentedOption.class); when(path.toURI()).thenReturn(FILE_URI); final org.uberfire.java.nio.file.Path expectedNioPath = Paths.convert(path); ((ProjectDiagramServiceController) diagramService).saveAsXml(path, xml, attributes, option); verify(ioService, times(1)).write(eq(expectedNioPath), eq(xml), eq(attributes), eq(option)); }