@@ -66,26 +66,19 @@ public void testAvailableAfterClose(final int len) throws Exception {
6666 assertEquals (0 , shadow .available ());
6767 }
6868
69- @ SuppressWarnings ("resource" )
7069 @ ParameterizedTest
7170 @ MethodSource (AbstractInputStreamTest .ARRAY_LENGTHS_NAME )
72- public void testReadAfterClose (final int len ) throws Exception {
73- final InputStream shadow ;
71+ public void testAvailableAfterOpen (final int len ) throws Exception {
7472 try (MarkTestableInputStream in = new MarkTestableInputStream (new NullInputStream (len , false , false ));
7573 final MarkShieldInputStream msis = new MarkShieldInputStream (in )) {
7674 assertEquals (len , in .available ());
77- shadow = in ;
7875 }
79- assertEquals (IOUtils .EOF , shadow .read ());
8076 }
8177
82- @ ParameterizedTest
83- @ MethodSource (AbstractInputStreamTest .ARRAY_LENGTHS_NAME )
84- public void testAvailableAfterOpen (final int len ) throws Exception {
85- try (MarkTestableInputStream in = new MarkTestableInputStream (new NullInputStream (len , false , false ));
86- final MarkShieldInputStream msis = new MarkShieldInputStream (in )) {
87- assertEquals (len , in .available ());
88- }
78+ @ SuppressWarnings ("resource" )
79+ @ Test
80+ public void testCloseHandleIOException () throws IOException {
81+ ProxyInputStreamTest .testCloseHandleIOException (new MarkShieldInputStream (new BrokenInputStream ((Throwable ) new IOException ())));
8982 }
9083
9184 @ Test
@@ -130,6 +123,19 @@ public void testMarkSupportedIsFalseWhenUnderlyingTrue() throws IOException {
130123 }
131124 }
132125
126+ @ SuppressWarnings ("resource" )
127+ @ ParameterizedTest
128+ @ MethodSource (AbstractInputStreamTest .ARRAY_LENGTHS_NAME )
129+ public void testReadAfterClose (final int len ) throws Exception {
130+ final InputStream shadow ;
131+ try (MarkTestableInputStream in = new MarkTestableInputStream (new NullInputStream (len , false , false ));
132+ final MarkShieldInputStream msis = new MarkShieldInputStream (in )) {
133+ assertEquals (len , in .available ());
134+ shadow = in ;
135+ }
136+ assertEquals (IOUtils .EOF , shadow .read ());
137+ }
138+
133139 @ Test
134140 public void testResetThrowsExceptionWhenUnderlyingDoesNotSupport () throws IOException {
135141 // test wrapping an underlying stream which does NOT support marking
0 commit comments