### Question:
ZipUtility { public static boolean createZipFromDirectory(final String directory, final String filename, final boolean absolute) { final File rootDir = new File(directory); final File saveFile = new File(filename); final ZipArchiveOutputStream zaos; try { zaos = new ZipArchiveOutputStream(new FileOutputStream(saveFile)); } catch (final FileNotFoundException e) { return false; } try { recurseFiles(rootDir, rootDir, zaos, absolute); } catch (final IOException e2) { FileUtils.close(zaos); return false; } try { zaos.finish(); } catch (final IOException e1) { } FileUtils.close(zaos); return true; } private  ZipUtility(); static boolean createZipFromDirectory(final String directory,
                                               final String filename,
                                               final boolean absolute); static boolean createZipFromFiles(final List<File> files,
                                           final String filename); static boolean createZipFromFiles(final File[] files,
                                           final String filename); static List<String> unZip(final File tarFile, final File directory); static void main(final String[] args);  }### Answer:
@Test public void createZipFromDirectory() throws IOException { final File dir = new File("/tmp/tests/dir"); FileUtils.createDir(dir); final File test = new File(dir, "test"); test.createNewFile(); final File test2 = new File(dir, "test2"); test2.createNewFile(); final File zip = new File(dir.getParentFile(), "testzip.zip"); assertTrue(ZipUtility.createZipFromDirectory(dir.getAbsolutePath(), zip.getAbsolutePath(), false)); FileUtils.forceDeleteRecursiveDir(dir); final List<String> list = ZipUtility.unZip(zip, dir); assertEquals(2, list.size()); final File[] arrayFile = FileUtils.getFiles(dir); assertEquals(2, arrayFile.length); int cpt = 0; for (final File file : arrayFile) { for (final String name : list) { if (name.equals(file.getName())) { cpt++; break; } } } assertEquals(2, cpt); FileUtils.forceDeleteRecursiveDir(dir); FileUtils.deleteDir(dir); FileUtils.delete(zip); }