### Question:
ZipUtils { public static void unzip(BeanByteSource source, Path path) { Path absolutePath = path.toAbsolutePath(); Set<ZipKey> deduplicate = new HashSet<>(); try (ZipInputStream in = new ZipInputStream(source.openStream())) { ZipEntry entry = in.getNextEntry(); while (entry != null) { Path resolved = validateZipPathName(absolutePath, entry); if (!entry.isDirectory()) { if (deduplicate.add(new ZipKey(entry, resolved))) { Files.createDirectories(resolved); Files.copy(in, resolved, StandardCopyOption.REPLACE_EXISTING); } } in.closeEntry(); entry = in.getNextEntry(); } } catch (IOException ex) { throw new UncheckedIOException(ex); } } private  ZipUtils(); static Set<String> unzipPathNames(BeanByteSource source); static Optional<ArrayByteSource> unzipPathNameInMemory(BeanByteSource source, String relativePathName); static void unzip(BeanByteSource source, Path path); static ArrayByteSource zipInMemory(List<? extends BeanByteSource> sources); static Map<String, ArrayByteSource> unpackInMemory(BeanByteSource source); static void unpackInMemory(BeanByteSource source, BiConsumer<String, ArrayByteSource> consumer); static Map<String, ArrayByteSource> unzipInMemory(BeanByteSource source); static void unzipInMemory(BeanByteSource source, BiConsumer<String, ArrayByteSource> consumer); static BeanByteSource decryptZip(BeanByteSource source, String password);  }### Answer:
@Test public void test_unzip_toPath_withFolders() { ArrayByteSource zipFile = load("TestFolder.zip"); ZipUtils.unzip(zipFile, tmpDir); assertThat(tmpDir.resolve("test/alpha/Alpha.txt")).hasContent("ALPHA"); assertThat(tmpDir.resolve("test/beta/Beta1.txt")).hasContent("BETA1"); assertThat(tmpDir.resolve("test/beta/Beta2.txt")).hasContent("BETA2"); }
@Test public void test_unzip_toPath_zipSlip() { ArrayByteSource zipFile = load("zip-slip.zip"); assertThatExceptionOfType(UncheckedIOException.class) .isThrownBy(() -> ZipUtils.unzip(zipFile, tmpDir)); }