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 907fc90f83c59afcff1e3fc0896aedcf1d137139
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Jul 7 16:26:31 2024 -0400

    Add ChecksumInputStreamTest#testAvailable()
---
 .../org/apache/commons/io/input/ChecksumInputStreamTest.java | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git 
a/src/test/java/org/apache/commons/io/input/ChecksumInputStreamTest.java 
b/src/test/java/org/apache/commons/io/input/ChecksumInputStreamTest.java
index 65e6f735c..f01eb0cb6 100644
--- a/src/test/java/org/apache/commons/io/input/ChecksumInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/ChecksumInputStreamTest.java
@@ -19,6 +19,7 @@ package org.apache.commons.io.input;
 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -33,6 +34,17 @@ import org.junit.jupiter.api.Test;
  */
 public class ChecksumInputStreamTest {
 
+    @SuppressWarnings("resource")
+    @Test
+    public void testAvailable() throws Exception {
+        final InputStream shadow;
+        try (InputStream in = 
ChecksumInputStream.builder().setCharSequence("Hi").get()) {
+            assertTrue(in.available() > 0);
+            shadow = in;
+        }
+        assertEquals(0, shadow.available());
+    }
+
     @Test
     public void testDefaultThresholdFailure() throws IOException {
         final byte[] byteArray = new byte[3];

Reply via email to