public void testForced() throws Exception {
    ZipArchiver archiver = newArchiver("archive2.zip");

    assertTrue(archiver.isForced());
    File f = archiver.getDestFile();
    if (f.exists()) {
      FileUtils.fileDelete(f.getPath());
    }
    assertFalse(f.exists());
    createArchive(archiver);
    long l1 = f.lastModified();
    assertTrue(f.exists());

    archiver = newArchiver("archive2.zip");
    waitUntilNewTimestamp(archiver.getDestFile(), l1);
    createArchive(archiver);
    long l2 = f.lastModified();
    assertTrue(f.exists());
    assertTrue(l2 > l1);

    archiver = newArchiver("archive2.zip");
    assertTrue(archiver.isSupportingForced());
    archiver.setForced(false);
    assertFalse(archiver.isForced());

    createArchive(archiver);
    long l3 = f.lastModified();
    assertTrue(f.exists());
    assertEquals(l2, l3);
  }
  private void createArchive(ZipArchiver archiver) throws ArchiverException, IOException {
    archiver.createArchive();

    ZipFile zf = new ZipFile(archiver.getDestFile());

    Enumeration e = zf.getEntries();

    while (e.hasMoreElements()) {
      ZipArchiveEntry ze = (ZipArchiveEntry) e.nextElement();
      if (ze.isDirectory()) {
        if (ze.getName().startsWith("worldwritable")) {
          fileModeAssert(0777, UnixStat.PERM_MASK & ze.getUnixMode());
        } else if (ze.getName().startsWith("groupwritable")) {
          fileModeAssert(0070, UnixStat.PERM_MASK & ze.getUnixMode());
        } else {
          fileModeAssert(0500, UnixStat.PERM_MASK & ze.getUnixMode());
        }
      } else {
        if (ze.getName().equals("one.txt")) {
          fileModeAssert(0640, UnixStat.PERM_MASK & ze.getUnixMode());
        } else if (ze.getName().equals("two.txt")) {
          fileModeAssert(0664, UnixStat.PERM_MASK & ze.getUnixMode());
        } else if (ze.isUnixSymlink()) {
          //         assertEquals( ze.getName(), 0500, UnixStat.PERM_MASK & ze.getUnixMode() );
        } else {
          fileModeAssert(0400, UnixStat.PERM_MASK & ze.getUnixMode());
        }
      }
    }
  }