예제 #1
0
  @Test
  public void shouldBeAbleToCreateEmptyArchive() throws IOException {
    CustomZipOutputStream ignored = ZipOutputStreams.newOutputStream(output);
    ignored.close();

    try (Zip zip = new Zip(output, /* forWriting */ false)) {
      assertTrue(zip.getFileNames().isEmpty());
    }
  }
예제 #2
0
  @Test
  public void shouldBeAbleToCreateEmptyArchiveWhenOverwriting() throws IOException {
    CustomZipOutputStream ignored = ZipOutputStreams.newOutputStream(output, OVERWRITE_EXISTING);
    ignored.close();

    try (Zip zip = new Zip(output, false)) {
      assertTrue(zip.getFileNames().isEmpty());
    }
  }
예제 #3
0
 @Before
 public void setUp() throws Exception {
   zipFile = new File(tmpFolder.getRoot(), "tmp.zip");
   try (Zip zip = new Zip(zipFile, true)) {
     zip.add("1.bin", DUMMY_FILE_CONTENTS);
     zip.add("subdir/2.bin", DUMMY_FILE_CONTENTS);
     zip.addDir("emptydir");
   }
 }