File tree Expand file tree Collapse file tree
src/test/java/org/apache/commons/io/input Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ public class AutoCloseInputStreamTest {
4040
4141 private boolean closed ;
4242
43+ @ SuppressWarnings ("deprecation" )
4344 @ BeforeEach
4445 public void setUp () {
4546 data = new byte [] { 'x' , 'y' , 'z' };
@@ -52,6 +53,16 @@ public void close() {
5253 closed = false ;
5354 }
5455
56+ @ Test
57+ public void testAvailableAfterClose () throws IOException {
58+ final InputStream shadow ;
59+ try (InputStream inputStream = new AutoCloseInputStream (new ByteArrayInputStream (data ))) {
60+ assertEquals (3 , inputStream .available ());
61+ shadow = inputStream ;
62+ }
63+ assertEquals (0 , shadow .available ());
64+ }
65+
5566 @ Test
5667 public void testAvailableAll () throws IOException {
5768 try (InputStream inputStream = new AutoCloseInputStream (new ByteArrayInputStream (data ))) {
@@ -178,4 +189,14 @@ public void testResetBeforeEndSetInputStream() throws IOException {
178189 }
179190 }
180191
192+ @ Test
193+ public void testrReadAfterClose () throws IOException {
194+ final InputStream shadow ;
195+ try (InputStream inputStream = new AutoCloseInputStream (new ByteArrayInputStream (data ))) {
196+ assertEquals (3 , inputStream .available ());
197+ shadow = inputStream ;
198+ }
199+ assertEquals (IOUtils .EOF , shadow .read ());
200+ }
201+
181202}
You can’t perform that action at this time.
0 commit comments