Skip to content
Permalink
Browse files
Fix some tests.
  • Loading branch information
garydgregory committed May 5, 2022
1 parent 102211b commit 5e4e6fbbd0a4b7872aedbc47fd04d00342677b6b
Showing 1 changed file with 4 additions and 3 deletions.
@@ -19,6 +19,7 @@
package org.apache.commons.compress.archivers.examples;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.io.File;
@@ -80,9 +81,9 @@ public void channelVersion() throws IOException, ArchiveException {
// not really a 7z test but I didn't feel like adding a new test just for this
@Test
public void unknownFormat() throws IOException, ArchiveException {
try (SeekableByteChannel c = FileChannel.open(target.toPath(), StandardOpenOption.WRITE,
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) {
new Archiver().create("unknown format", c, dir);
try (SeekableByteChannel c = FileChannel.open(target.toPath(), StandardOpenOption.WRITE, StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING)) {
assertThrows(ArchiveException.class, () -> new Archiver().create("unknown format", c, dir));
}
}

0 comments on commit 5e4e6fb

Please sign in to comment.