### Question:
ZipUtils { public static List<String> generateZip(String srcFolder, String outputZip) throws IOException, URISyntaxException { final Path targetZip = Paths.get(outputZip); final Path sourceDir = Paths.get(srcFolder); final URI uri = new URI("jar", URLDecoder.decode(targetZip.toUri().toString(), "UTF-8"), null); final List<String> files = new ArrayList<>(); try (FileSystem zipfs = FileSystems.newFileSystem(uri, singletonMap("create", "true"))) { Files.walkFileTree(sourceDir, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (targetZip.equals(file)) { return FileVisitResult.CONTINUE; } Path target = zipfs.getPath(sourceDir.relativize(file).toString()); if (target.getParent() != null) { Files.createDirectories(target.getParent()); } Files.copy(file, target, StandardCopyOption.REPLACE_EXISTING); files.add(file.toString()); return FileVisitResult.CONTINUE; } }); } return files; } private  ZipUtils(); static List<String> generateZip(String srcFolder, String outputZip);  }### Answer:
@Test public void tryZippingAFolderWithSpace() throws IOException, URISyntaxException { String testFolder = "/zipUtils/Fake Folder"; testFolder = new File(ZipUtilsTest.class.getResource(testFolder).toURI().getPath()).getAbsolutePath(); Path zipTempFolder = Files.createTempDirectory("tmp"); String outputZip = zipTempFolder + File.separator + "Fake Folder.zip"; ZipUtils.generateZip(testFolder, outputZip); File f = new File(outputZip); Assert.assertTrue(f.exists() && !f.isDirectory()); }