SmartlingResultProcessor { Path zipFiles(List<SmartlingFile> files, String name) throws IOException { Path tmpDir = Files.createTempDirectory(name); for (SmartlingFile file : files) { Path filePath = Paths.get(tmpDir.toString(), file.getFileName()); Files.createDirectories(filePath.getParent()); Files.write(filePath, file.getFileContent().getBytes(StandardCharsets.UTF_8)); } return zipDirectory(tmpDir); }  String processPush(List<SmartlingFile> files,
                              SmartlingOptions options); String processPushTranslations(List<SmartlingFile> files,
                                          SmartlingOptions options);  }
@Test public void testZipFiles() throws Exception { List<SmartlingFile> files = fileList(4); Path zipFile = processor.zipFiles(files, "my-request-id-" + UUID.randomUUID().toString() + "-some-type"); List<SmartlingFile> zippedFiles = readFilesFromZip(zipFile); assertThat(zippedFiles).extracting("fileName", "fileContent") .containsExactlyInAnyOrder( tuple(files.get(0).getFileName(), files.get(0).getFileContent()), tuple(files.get(1).getFileName(), files.get(1).getFileContent()), tuple(files.get(2).getFileName(), files.get(2).getFileContent()), tuple(files.get(3).getFileName(), files.get(3).getFileContent()) ); Files.deleteIfExists(zipFile.toFile().toPath()); }
@Test public void testZipFilesEmpty() throws IOException { Path zipFile = processor.zipFiles(Collections.emptyList(), "invalid"); assertThat(readFilesFromZip(zipFile)).isEmpty(); }