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 2024/07/14 14:51:38 UTC
(commons-io) 06/06: Add TeeInputStreamTest.testCloseHandleIOException()
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 54770589b1e02356093981ab012b9f34c1439658
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jul 14 10:44:15 2024 -0400
Add TeeInputStreamTest.testCloseHandleIOException()
---
.../java/org/apache/commons/io/input/TeeInputStreamTest.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/test/java/org/apache/commons/io/input/TeeInputStreamTest.java b/src/test/java/org/apache/commons/io/input/TeeInputStreamTest.java
index 49527a929..18d9326e4 100644
--- a/src/test/java/org/apache/commons/io/input/TeeInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/TeeInputStreamTest.java
@@ -71,6 +71,15 @@ public class TeeInputStreamTest {
verify(goodIs, times(2)).close();
}
+ @SuppressWarnings({ "resource" })
+ @Test
+ public void testCloseHandleIOException() throws IOException {
+ ProxyInputStreamTest
+ .testCloseHandleIOException(new TeeInputStream(new BrokenInputStream((Throwable) new IOException()), new ByteArrayOutputStream(), false));
+ ProxyInputStreamTest
+ .testCloseHandleIOException(new TeeInputStream(new BrokenInputStream((Throwable) new IOException()), new ByteArrayOutputStream(), true));
+ }
+
/**
* Tests that the branch {@code OutputStream} is closed when closing the main {@code InputStream} throws an
* exception on {@link TeeInputStream#close()}, if specified to do so.