Add missing AutoCloseInputStream test
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
-
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
private byte[] data;
- private InputStream stream;
+ private AutoCloseInputStream stream;
private boolean closed;
@@ -57,6 +55,13 @@ public void testClose() throws IOException {
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) {
