MoreFiles { public static void extractZip(File zip, File toDir) throws IOException { try (ZipInputStream zis = new ZipInputStream(new FileInputStream(zip))) { ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { if (!entry.isDirectory()) { File file = new File(toDir, entry.getName()); createParentDirs(file); Files.copy(zis, file.toPath()); zis.closeEntry(); } } } }  static void delete(Path path); static Closeable watch(Path dir, EventBus eventBus,
                             ExecutorService executor, WatcherSettings watcherSettings); static void copyDir(final Path sourceDir, final Path targetDir); static void checkFileExists(String location); static void extractZip(File zip, File toDir); static String removeWindowsCarriageReturnsBeforeLF(String str); static final Function<? super Path, ? extends File> pathToFile; static final Function<String, Path> strToPath; }
@Test public void should_extract_zip() throws Exception { File dest = folder.newFolder("dest"); extractZip(new File("src/test/resources/restx/common/test.zip"), dest); assertThat(new File(dest, "A.txt")).exists(); assertThat(new File(dest, "1/B.txt")).exists(); assertThat(new File(dest, "1/C.txt")).exists(); assertThat(new File(dest, "2/D.txt")).exists(); assertThat(new File(dest, "2/E.txt")).exists().hasContent("hello"); }