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 0fd437d1db3870cb55bff32cdf7d0c854c29e77b Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Jul 7 14:21:36 2024 -0400 Add BoundedInputStreamTest.testAvailable() --- .../org/apache/commons/io/input/BoundedInputStreamTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java b/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java index c75c9c732..994cbe033 100644 --- a/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java +++ b/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java @@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayInputStream; +import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.concurrent.atomic.AtomicBoolean; @@ -46,6 +47,17 @@ public class BoundedInputStreamTest { } } + @SuppressWarnings("resource") + @Test + public void testAvailable() throws Exception { + final InputStream shadow; + try (InputStream in = BoundedInputStream.builder().setCharSequence("Hi").get()) { + assertTrue(in.available() > 0); + shadow = in; + } + assertEquals(0, shadow.available()); + } + @Test public void testBuilderGet() { // java.lang.IllegalStateException: origin == null