Skip to content

Commit a62237f

Browse files
author
Gary Gregory
committed
Add missing AutoCloseInputStream test
1 parent 7a3df40 commit a62237f

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
import java.io.ByteArrayInputStream;
2424
import java.io.IOException;
25-
import java.io.InputStream;
26-
2725
import org.junit.jupiter.api.BeforeEach;
2826
import org.junit.jupiter.api.Test;
2927

@@ -34,7 +32,7 @@ public class AutoCloseInputStreamTest {
3432

3533
private byte[] data;
3634

37-
private InputStream stream;
35+
private AutoCloseInputStream stream;
3836

3937
private boolean closed;
4038

@@ -57,6 +55,13 @@ public void testClose() throws IOException {
5755
assertEquals(-1, stream.read(), "read()");
5856
}
5957

58+
@Test
59+
public void testFinalize() throws Throwable {
60+
stream.finalize();
61+
assertTrue(closed, "closed");
62+
assertEquals(-1, stream.read(), "read()");
63+
}
64+
6065
@Test
6166
public void testRead() throws IOException {
6267
for (final byte element : data) {

0 commit comments

Comments
 (0)