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


The following commit(s) were added to refs/heads/master by this push:
     new a62237f2 Add missing AutoCloseInputStream test
a62237f2 is described below

commit a62237f21723e27165f9c6f388f7cfeeb089c9a3
Author: Gary Gregory <gardgreg...@gmail.com>
AuthorDate: Mon Jul 25 18:44:21 2022 -0400

    Add missing AutoCloseInputStream test
---
 .../org/apache/commons/io/input/AutoCloseInputStreamTest.java | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java 
b/src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java
index 7665de3a..b80b2fb1 100644
--- a/src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java
@@ -22,8 +22,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.io.InputStream;
-
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -34,7 +32,7 @@ public class AutoCloseInputStreamTest {
 
     private byte[] data;
 
-    private InputStream stream;
+    private AutoCloseInputStream stream;
 
     private boolean closed;
 
@@ -57,6 +55,13 @@ public class AutoCloseInputStreamTest {
         assertEquals(-1, stream.read(), "read()");
     }
 
+    @Test
+    public void testFinalize() throws Throwable {
+        stream.finalize();
+        assertTrue(closed, "closed");
+        assertEquals(-1, stream.read(), "read()");
+    }
+
     @Test
     public void testRead() throws IOException {
         for (final byte element : data) {

Reply via email to