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/07/09 14:57:10 UTC

[commons-io] 02/04: Test should generate temporary files in the Maven "target" folder instead of the root

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-io.git

commit ba967e37989bf21a3f2244f2b1b104cbb5b7b22a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jul 9 10:21:40 2023 -0400

    Test should generate temporary files in the Maven "target" folder
    instead of the root
---
 .../org/apache/commons/io/output/DeferredFileOutputStreamTest.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/io/output/DeferredFileOutputStreamTest.java b/src/test/java/org/apache/commons/io/output/DeferredFileOutputStreamTest.java
index 8ee317f8..3969e714 100644
--- a/src/test/java/org/apache/commons/io/output/DeferredFileOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/output/DeferredFileOutputStreamTest.java
@@ -29,6 +29,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.stream.IntStream;
 
 import org.apache.commons.io.FileUtils;
@@ -195,14 +196,14 @@ public class DeferredFileOutputStreamTest {
 
         final String prefix = "commons-io-test";
         final String suffix = ".out";
-        final File tempDir = FileUtils.current();
+        final Path tempDir = Paths.get("target");
         // @formatter:off
         final DeferredFileOutputStream dfos = DeferredFileOutputStream.builder()
                 .setThreshold(testBytes.length - 5)
                 .setBufferSize(initialBufferSize)
                 .setPrefix(prefix)
                 .setSuffix(suffix)
-                .setDirectory(tempDir)
+                .setDirectory(tempDir.toFile())
                 .get();
         // @formatter:on
         assertNull(dfos.getFile(), "Check File is null-A");
@@ -216,7 +217,7 @@ public class DeferredFileOutputStreamTest {
         assertTrue(dfos.getFile().exists(), "Check file exists");
         assertTrue(dfos.getFile().getName().startsWith(prefix), "Check prefix");
         assertTrue(dfos.getFile().getName().endsWith(suffix), "Check suffix");
-        assertEquals(tempDir.getPath(), dfos.getFile().getParent(), "Check dir");
+        assertEquals(tempDir, dfos.getPath().getParent(), "Check dir");
 
         verifyResultFile(dfos.getFile());