You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/01/28 15:29:22 UTC

[commons-compress] branch master updated: Tests should delete files it creates

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 53ad915c Tests should delete files it creates
53ad915c is described below

commit 53ad915cde32c4ccffdac03b97e654694867e37e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jan 28 10:29:17 2023 -0500

    Tests should delete files it creates
---
 .../commons/compress/archivers/ZipTestCase.java       | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java b/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
index 2eccf953..7453019b 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
@@ -174,14 +174,25 @@ public final class ZipTestCase extends AbstractTestCase {
     }
 
     @Test
-    public void buildSplitZipWithTooLargeSizeThrowsException() {
-        assertThrows(IllegalArgumentException.class, () -> new ZipArchiveOutputStream(File.createTempFile("temp", "zip"), 4294967295L + 1));
+    public void buildSplitZipWithTooLargeSizeThrowsException() throws IOException {
+        final Path file = Files.createTempFile("temp", "zip");
+        try {
+            assertThrows(IllegalArgumentException.class, () -> new ZipArchiveOutputStream(file, 4294967295L + 1));
+        } finally {
+            Files.delete(file);
+        }
     }
 
     @Test
-    public void buildSplitZipWithTooSmallSizeThrowsException() {
-        assertThrows(IllegalArgumentException.class, () -> new ZipArchiveOutputStream(File.createTempFile("temp", "zip"), 64 * 1024 - 1));
+    public void buildSplitZipWithTooSmallSizeThrowsException() throws IOException {
+        final Path file = Files.createTempFile("temp", "zip");
+        try {
+            assertThrows(IllegalArgumentException.class, () -> new ZipArchiveOutputStream(File.createTempFile("temp", "zip"), 64 * 1024 - 1));
+        } finally {
+            Files.delete(file);
+        }
     }
+
     private int countNonDirectories(final File file) {
         if (!file.isDirectory()) {
             return 1;