VersionServiceImpl implements VersionService { @Override public Path restore(final Path _path, final String comment, final String branchName) { try { ioService.startBatch(Paths.convert(_path).getFileSystem()); final org.uberfire.java.nio.file.Path path = pathResolver.resolveMainFilePath(convert(_path)); final org.uberfire.java.nio.file.Path target = versionUtil.getPath(path, branchName); return convert(ioService.copy(path, target, REPLACE_EXISTING, new CommentedOption( sessionInfo != null ? sessionInfo.getId() : "--", sessionInfo != null ? sessionInfo.getIdentity().getIdentifier() : "system", null, comment))); } catch (Exception e) { throw new RuntimeException(e); } finally { ioService.endBatch(); } }  @Override List<VersionRecord> getVersions(final Path path); @Override Path getPathToPreviousVersion(String uri); @Override Path restore(final Path _path,
                        final String comment,
                        final String branchName);  }
@Test public void restore() throws URISyntaxException { final Path path = new PathFactory.PathImpl("foo.txt", "default: final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); doReturn(nioPath).when(pathResolver).resolveMainFilePath(any()); final InOrder order = inOrder(ioService); versionService.restore(path, "Restore comment", "master"); order.verify(ioService).startBatch(nioPath.getFileSystem()); order.verify(ioService).copy(eq(nioPath), any(), eq(REPLACE_EXISTING), any(CommentedOption.class)); order.verify(ioService).endBatch(); }