AbstractModuleRepositoriesServiceImpl implements ModuleRepositoriesService { @Override public Path save(final Path resource, final ModuleRepositories moduleRepositories, final String comment) { try { ioService.write(Paths.convert(resource), contentHandler.toString(moduleRepositories)); return resource; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } } AbstractModuleRepositoriesServiceImpl();  AbstractModuleRepositoriesServiceImpl(final IOService ioService,
                                                 final ModuleRepositoryResolver repositoryResolver,
                                                 final ModuleRepositoriesContentHandler contentHandler,
                                                 final CommentedOptionFactory commentedOptionFactory); @Override ModuleRepositories create(final Path path); @Override ModuleRepositories load(final Path path); @Override Path save(final Path resource,
                     final ModuleRepositories moduleRepositories,
                     final String comment);  }
@Test public void testSave() { final Set<ModuleRepositories.ModuleRepository> repositories = new HashSet<ModuleRepositories.ModuleRepository>(); repositories.add(new ModuleRepositories.ModuleRepository(true, new MavenRepositoryMetadata("id", "url", MavenRepositorySource.LOCAL))); final ModuleRepositories moduleRepositories = new ModuleRepositories(repositories); final String xml = "<project-repositories>\n" + " <repositories>\n" + " <repository>\n" + " <include>true</include>\n" + " <metadata>\n" + " <id>id</id>\n" + " <url>url</url>\n" + " <source>LOCAL</source>\n" + " </metadata>\n" + " </repository>\n" + " </repositories>\n" + "</project-repositories>"; final Path path = mock(Path.class); when(path.toURI()).thenReturn("file: final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); service.save(path, moduleRepositories, "comment"); verify(ioService, times(1)).write(eq(nioPath), eq(xml)); }