Add missing AccumulatorPathVisitor tests
MODIFY
src/test/java/org/apache/commons/io/file/AccumulatorPathVisitorTest.java
src/test/java/org/apache/commons/io/file/AccumulatorPathVisitorTest.java
import org.apache.commons.io.filefilter.DirectoryFileFilter;
import org.apache.commons.io.filefilter.EmptyFileFilter;
import org.apache.commons.io.filefilter.PathVisitorFileFilter;
+import org.apache.commons.io.filefilter.TrueFileFilter;
import org.apache.commons.io.function.IOBiFunction;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
// @formatter:off
return Stream.of(
Arguments.of((Supplier<AccumulatorPathVisitor>) AccumulatorPathVisitor::withLongCounters),
- Arguments.of((Supplier<AccumulatorPathVisitor>) AccumulatorPathVisitor::withBigIntegerCounters));
+ Arguments.of((Supplier<AccumulatorPathVisitor>) AccumulatorPathVisitor::withBigIntegerCounters),
+ Arguments.of((Supplier<AccumulatorPathVisitor>) () ->
+ AccumulatorPathVisitor.withBigIntegerCounters(TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE)));
// @formatter:on
}
@TempDir
Path tempDirPath;
+ /**
+ * Tests the 0-argument constructor.
+ */
@Test
public void test0ArgConstructor() throws IOException {
final AccumulatorPathVisitor accPathVisitor = new AccumulatorPathVisitor();
@@ -85,6 +91,8 @@ public void test0ArgConstructor() throws IOException {
assertCounts(0, 0, 0, accPathVisitor.getPathCounters());
assertEquals(1, accPathVisitor.getDirList().size());
assertTrue(accPathVisitor.getFileList().isEmpty());
+ assertEquals(accPathVisitor, accPathVisitor);
+ assertEquals(accPathVisitor.hashCode(), accPathVisitor.hashCode());
}
/**
@@ -99,6 +107,8 @@ public void testEmptyFolder(final Supplier<AccumulatorPathVisitor> supplier) thr
assertCounts(1, 0, 0, accPathVisitor.getPathCounters());
assertEquals(1, accPathVisitor.getDirList().size());
assertTrue(accPathVisitor.getFileList().isEmpty());
+ assertEquals(accPathVisitor, accPathVisitor);
+ assertEquals(accPathVisitor.hashCode(), accPathVisitor.hashCode());
}
/**
@@ -113,6 +123,8 @@ public void testFolders1FileSize0(final Supplier<AccumulatorPathVisitor> supplie
assertCounts(1, 1, 0, accPathVisitor.getPathCounters());
assertEquals(1, accPathVisitor.getDirList().size());
assertEquals(1, accPathVisitor.getFileList().size());
+ assertEquals(accPathVisitor, accPathVisitor);
+ assertEquals(accPathVisitor.hashCode(), accPathVisitor.hashCode());
}
/**
@@ -127,6 +139,8 @@ public void testFolders1FileSize1(final Supplier<AccumulatorPathVisitor> supplie
assertCounts(1, 1, 1, accPathVisitor.getPathCounters());
assertEquals(1, accPathVisitor.getDirList().size());
assertEquals(1, accPathVisitor.getFileList().size());
+ assertEquals(accPathVisitor, accPathVisitor);
+ assertEquals(accPathVisitor.hashCode(), accPathVisitor.hashCode());
}
/**
@@ -141,6 +155,8 @@ public void testFolders2FileSize2(final Supplier<AccumulatorPathVisitor> supplie
assertCounts(3, 2, 2, accPathVisitor.getPathCounters());
assertEquals(3, accPathVisitor.getDirList().size());
assertEquals(2, accPathVisitor.getFileList().size());
+ assertEquals(accPathVisitor, accPathVisitor);
+ assertEquals(accPathVisitor.hashCode(), accPathVisitor.hashCode());
}
/**
@@ -200,6 +216,8 @@ public FileVisitResult visitFile(final Path path, final BasicFileAttributes attr
}
executor.shutdownNow();
}
+ assertEquals(accPathVisitor, accPathVisitor);
+ assertEquals(accPathVisitor.hashCode(), accPathVisitor.hashCode());
}
/**
@@ -234,6 +252,8 @@ public FileVisitResult visitFile(final Path path, final BasicFileAttributes attr
assertCounts(1, marker - 1, 0, accPathVisitor.getPathCounters());
assertEquals(1, accPathVisitor.getDirList().size());
assertEquals(marker - 1, accPathVisitor.getFileList().size());
+ assertEquals(accPathVisitor, accPathVisitor);
+ assertEquals(accPathVisitor.hashCode(), accPathVisitor.hashCode());
}
}

Add missing AccumulatorPathVisitor tests