ZipUtils { public static void unzip(File zip, File targetDir) throws IOException { try (InputStream in = new FileInputStream(zip)) { unzip(in, targetDir); } } private  ZipUtils(); static ZipOutputStream stream(Path zip); static void add(ZipOutputStream out, Path f); static void add(ZipOutputStream out, Path f, Path rootPath); static Collection<String> listEntries(File zip); static Collection<String> listEntries(InputStream in); static void unzip(File zip, File targetDir); static void unzip(InputStream in, File targetDir); static void getResources(ZipFile zip, Pattern filter, Consumer<InputStream> consumer); static boolean isZipFile(File file);  }
@Test public void testUnzipFile() throws Exception { Path targetDir = Paths.get(zipFile.getParent()); ZipUtils.unzip(zipFile, targetDir.toFile()); Path unzippedFile = Paths.get(targetDir.toString(), FILE_NAME); Assert.assertEquals(testData, Files.readAllBytes(unzippedFile)); Files.delete(unzippedFile); }