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/07/25 20:22:43 UTC

[commons-io] branch master updated (af77aa87 -> 426a7930)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


    from af77aa87 Get IOPredicate to 100% code coverage
     new 52c8a27b Add some missing tests.
     new 22bd091b Javadoc
     new ecde1877 Add missing test in IOUtils
     new 426a7930 Javadoc

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/commons/io/file/NoopPathVisitor.java    |  2 --
 .../java/org/apache/commons/io/IOUtilsTest.java    |  3 ++-
 .../apache/commons/io/function/IOConsumerTest.java | 30 ++++++++++++++++++++--
 3 files changed, 30 insertions(+), 5 deletions(-)


[commons-io] 02/04: Javadoc

Posted by gg...@apache.org.
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 22bd091b24f645207c52c55df00a9a73a3749226
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jul 25 15:47:03 2022 -0400

    Javadoc
---
 src/test/java/org/apache/commons/io/IOUtilsTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/io/IOUtilsTest.java b/src/test/java/org/apache/commons/io/IOUtilsTest.java
index de8a0d49..9683f9c8 100644
--- a/src/test/java/org/apache/commons/io/IOUtilsTest.java
+++ b/src/test/java/org/apache/commons/io/IOUtilsTest.java
@@ -80,7 +80,7 @@ import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.io.TempDir;
 
 /**
- * This is used to test IOUtils for correctness. The following checks are performed:
+ * This is used to test {@link IOUtils} for correctness. The following checks are performed:
  * <ul>
  * <li>The return must not be null, must be the same type and equals() to the method's second arg</li>
  * <li>All bytes must have been read from the source (available() == 0)</li>


[commons-io] 04/04: Javadoc

Posted by gg...@apache.org.
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 426a7930066e0325843482bc30dd3c62b4737d10
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jul 25 15:57:51 2022 -0400

    Javadoc
---
 src/main/java/org/apache/commons/io/file/NoopPathVisitor.java | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/file/NoopPathVisitor.java b/src/main/java/org/apache/commons/io/file/NoopPathVisitor.java
index 8fc07d5f..20393a43 100644
--- a/src/main/java/org/apache/commons/io/file/NoopPathVisitor.java
+++ b/src/main/java/org/apache/commons/io/file/NoopPathVisitor.java
@@ -37,8 +37,6 @@ public class NoopPathVisitor extends SimplePathVisitor {
 
     /**
      * Constructs a new instance.
-     *
-     * @since 2.12.0
      */
     public NoopPathVisitor() {
     }


[commons-io] 03/04: Add missing test in IOUtils

Posted by gg...@apache.org.
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 ecde1877108a7d27aeb40d537b65f4592f0e1e54
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jul 25 15:51:06 2022 -0400

    Add missing test in IOUtils
---
 src/test/java/org/apache/commons/io/IOUtilsTest.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/test/java/org/apache/commons/io/IOUtilsTest.java b/src/test/java/org/apache/commons/io/IOUtilsTest.java
index 9683f9c8..9623fa8f 100644
--- a/src/test/java/org/apache/commons/io/IOUtilsTest.java
+++ b/src/test/java/org/apache/commons/io/IOUtilsTest.java
@@ -348,6 +348,7 @@ public class IOUtilsTest {
         assertDoesNotThrow(() -> IOUtils.closeQuietly(closeable, null, closeable));
         assertDoesNotThrow(() -> IOUtils.closeQuietly(Arrays.asList(closeable, null, closeable)));
         assertDoesNotThrow(() -> IOUtils.closeQuietly(Stream.of(closeable, null, closeable)));
+        assertDoesNotThrow(() -> IOUtils.closeQuietly((Iterable<Closeable>) null));
     }
 
     @Test


[commons-io] 01/04: Add some missing tests.

Posted by gg...@apache.org.
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 52c8a27b1b4a22dab65032d621adc471f89bfb08
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jul 25 15:45:40 2022 -0400

    Add some missing tests.
---
 .../apache/commons/io/function/IOConsumerTest.java | 30 ++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/io/function/IOConsumerTest.java b/src/test/java/org/apache/commons/io/function/IOConsumerTest.java
index 4b557c14..79c421e9 100644
--- a/src/test/java/org/apache/commons/io/function/IOConsumerTest.java
+++ b/src/test/java/org/apache/commons/io/function/IOConsumerTest.java
@@ -18,12 +18,16 @@
 package org.apache.commons.io.function;
 
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import java.io.Closeable;
 import java.io.IOException;
 import java.io.StringReader;
+import java.nio.file.Files;
+import java.util.concurrent.atomic.AtomicReference;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.Uncheck;
+import org.apache.commons.io.file.PathUtils;
 import org.apache.commons.io.test.ThrowOnCloseReader;
 import org.junit.jupiter.api.Test;
 
@@ -33,7 +37,28 @@ import org.junit.jupiter.api.Test;
 public class IOConsumerTest {
 
     @Test
-    public void testNoopIOConsumer() {
+    void testAccept() throws IOException {
+        IOConsumer.noop().accept(null);
+        IOConsumer.noop().accept(".");
+        Uncheck.accept(Files::size, PathUtils.current());
+        //
+        final AtomicReference<String> ref = new AtomicReference<>();
+        final IOConsumer<String> consumer = s -> ref.set(s + "1");
+        consumer.accept("A");
+        assertEquals("A1", ref.get());
+    }
+
+    @Test
+    void testAndThen() throws IOException {
+        final AtomicReference<String> ref = new AtomicReference<>();
+        final IOConsumer<String> consumer1 = s -> ref.set(s + "1");
+        final IOConsumer<String> consumer2 = s -> ref.set(ref.get() + "2" + s);
+        consumer1.andThen(consumer2).accept("B");
+        assertEquals("B12B", ref.get());
+    }
+
+    @Test
+    public void testNoop() {
         final Closeable nullCloseable = null;
         final IOConsumer<IOException> noopConsumer = IOConsumer.noop(); // noop consumer doesn't throw
         assertDoesNotThrow(() -> IOUtils.close(nullCloseable, noopConsumer));
@@ -41,4 +66,5 @@ public class IOConsumerTest {
         assertDoesNotThrow(() -> IOUtils.close(new ThrowOnCloseReader(new StringReader("s")), noopConsumer));
     }
 
+
 }