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 2022/06/19 15:13:00 UTC

[commons-io] branch master updated: Convert the TempDir from a File to a Path

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


The following commit(s) were added to refs/heads/master by this push:
     new 2f350409 Convert the TempDir from a File to a Path
2f350409 is described below

commit 2f35040972acb3ffd499b17194024f38fbfb2769
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 19 11:12:55 2022 -0400

    Convert the TempDir from a File to a Path
---
 .../commons/io/file/AccumulatorPathVisitorTest.java      | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/test/java/org/apache/commons/io/file/AccumulatorPathVisitorTest.java b/src/test/java/org/apache/commons/io/file/AccumulatorPathVisitorTest.java
index 019fd6c4..fbbb86f1 100644
--- a/src/test/java/org/apache/commons/io/file/AccumulatorPathVisitorTest.java
+++ b/src/test/java/org/apache/commons/io/file/AccumulatorPathVisitorTest.java
@@ -21,7 +21,6 @@ import static org.apache.commons.io.file.CounterAssertions.assertCounts;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -52,7 +51,7 @@ public class AccumulatorPathVisitorTest {
     }
 
     @TempDir
-    File tempDirFile;
+    Path tempDirFile;
 
     /**
      * Tests an empty folder.
@@ -60,11 +59,9 @@ public class AccumulatorPathVisitorTest {
     @ParameterizedTest
     @MethodSource("testParameters")
     public void testEmptyFolder(final Supplier<AccumulatorPathVisitor> supplier) throws IOException {
-        final Path tempDir = tempDirFile.toPath();
         final AccumulatorPathVisitor accPathVisitor = supplier.get();
         final PathVisitorFileFilter countingFileFilter = new PathVisitorFileFilter(accPathVisitor);
-        Files.walkFileTree(tempDir,
-            new AndFileFilter(countingFileFilter, DirectoryFileFilter.INSTANCE, EmptyFileFilter.EMPTY));
+        Files.walkFileTree(tempDirFile, new AndFileFilter(countingFileFilter, DirectoryFileFilter.INSTANCE, EmptyFileFilter.EMPTY));
         assertCounts(1, 0, 0, accPathVisitor.getPathCounters());
         assertEquals(1, accPathVisitor.getDirList().size());
         assertTrue(accPathVisitor.getFileList().isEmpty());
@@ -78,8 +75,7 @@ public class AccumulatorPathVisitorTest {
     public void testFolders1FileSize0(final Supplier<AccumulatorPathVisitor> supplier) throws IOException {
         final AccumulatorPathVisitor accPathVisitor = supplier.get();
         final PathVisitorFileFilter countingFileFilter = new PathVisitorFileFilter(accPathVisitor);
-        Files.walkFileTree(Paths.get("src/test/resources/org/apache/commons/io/dirs-1-file-size-0"),
-            countingFileFilter);
+        Files.walkFileTree(Paths.get("src/test/resources/org/apache/commons/io/dirs-1-file-size-0"), countingFileFilter);
         assertCounts(1, 1, 0, accPathVisitor.getPathCounters());
         assertEquals(1, accPathVisitor.getDirList().size());
         assertEquals(1, accPathVisitor.getFileList().size());
@@ -93,8 +89,7 @@ public class AccumulatorPathVisitorTest {
     public void testFolders1FileSize1(final Supplier<AccumulatorPathVisitor> supplier) throws IOException {
         final AccumulatorPathVisitor accPathVisitor = supplier.get();
         final PathVisitorFileFilter countingFileFilter = new PathVisitorFileFilter(accPathVisitor);
-        Files.walkFileTree(Paths.get("src/test/resources/org/apache/commons/io/dirs-1-file-size-1"),
-            countingFileFilter);
+        Files.walkFileTree(Paths.get("src/test/resources/org/apache/commons/io/dirs-1-file-size-1"), countingFileFilter);
         assertCounts(1, 1, 1, accPathVisitor.getPathCounters());
         assertEquals(1, accPathVisitor.getDirList().size());
         assertEquals(1, accPathVisitor.getFileList().size());
@@ -108,8 +103,7 @@ public class AccumulatorPathVisitorTest {
     public void testFolders2FileSize2(final Supplier<AccumulatorPathVisitor> supplier) throws IOException {
         final AccumulatorPathVisitor accPathVisitor = supplier.get();
         final PathVisitorFileFilter countingFileFilter = new PathVisitorFileFilter(accPathVisitor);
-        Files.walkFileTree(Paths.get("src/test/resources/org/apache/commons/io/dirs-2-file-size-2"),
-            countingFileFilter);
+        Files.walkFileTree(Paths.get("src/test/resources/org/apache/commons/io/dirs-2-file-size-2"), countingFileFilter);
         assertCounts(3, 2, 2, accPathVisitor.getPathCounters());
         assertEquals(3, accPathVisitor.getDirList().size());
         assertEquals(2, accPathVisitor.getFileList().size());