From 54770589b1e02356093981ab012b9f34c1439658 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 14 Jul 2024 10:44:15 -0400 Subject: [PATCH] Add TeeInputStreamTest.testCloseHandleIOException() --- .../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 49527a9296b..18d9326e40f 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 void testCloseBranchIOException() throws Exception { 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.