This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push:
new 9c762830 Fix broken tests.
9c762830 is described below
commit 9c7628308aeeeeb368832226206d6b428e67d0c5
Author: Gary Gregory <[email protected]>
AuthorDate: Thu May 5 15:17:03 2022 -0400
Fix broken tests.
---
.../commons/compress/archivers/examples/ExpanderTest.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git
a/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
b/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
index b61b26be..c7de3d65 100644
---
a/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
+++
b/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
@@ -35,6 +35,7 @@ import org.apache.commons.compress.AbstractTestCase;
import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.compress.archivers.ArchiveOutputStream;
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.commons.compress.archivers.StreamingNotSupportedException;
import org.apache.commons.compress.archivers.sevenz.SevenZFile;
import org.apache.commons.compress.archivers.sevenz.SevenZOutputFile;
import org.apache.commons.compress.archivers.tar.TarFile;
@@ -48,9 +49,6 @@ import org.junit.rules.ExpectedException;
public class ExpanderTest extends AbstractTestCase {
- @Rule
- public final ExpectedException thrown = ExpectedException.none();
-
private File archive;
@Test
@@ -71,7 +69,7 @@ public class ExpanderTest extends AbstractTestCase {
public void sevenZInputStreamVersion() throws IOException,
ArchiveException {
setup7z();
try (InputStream i = new
BufferedInputStream(Files.newInputStream(archive.toPath()))) {
- new Expander().expand("7z", i, resultDir);
+ assertThrows(StreamingNotSupportedException.class, () -> new
Expander().expand("7z", i, resultDir));
}
}
@@ -79,7 +77,7 @@ public class ExpanderTest extends AbstractTestCase {
public void sevenZInputStreamVersionWithAutoDetection() throws
IOException, ArchiveException {
setup7z();
try (InputStream i = new
BufferedInputStream(Files.newInputStream(archive.toPath()))) {
- new Expander().expand(i, resultDir);
+ assertThrows(StreamingNotSupportedException.class, () -> new
Expander().expand(i, resultDir));
}
}
@@ -114,9 +112,9 @@ public class ExpanderTest extends AbstractTestCase {
public void fileCantEscapeViaAbsolutePath() throws IOException,
ArchiveException {
setupZip("/tmp/foo");
try (ZipFile f = new ZipFile(archive)) {
- new Expander().expand(f, resultDir);
+ assertThrows(IOException.class, () -> new Expander().expand(f,
resultDir));
}
- assertHelloWorld("tmp/foo", "1");
+ Assert.assertFalse(new File(resultDir, "tmp/foo").isFile());
}
@Test