org.apache.commons.io.input.BoundedInputStreamTest.testBuilderGet()
diff --git a/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java b/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java
index 7921454..5ae071f 100644
--- a/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/BoundedInputStreamTest.java
@@ -18,6 +18,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
@@ -39,16 +40,21 @@
}
}
+ @Test
+ public void testBuilderGet() {
+ // java.lang.IllegalStateException: origin == null
+ assertThrows(IllegalStateException.class, () -> BoundedInputStream.builder().get());
+ }
+
@SuppressWarnings("deprecation")
@Test
public void testOnMaxLength() throws Exception {
- BoundedInputStream bounded;
final byte[] helloWorld = "Hello World".getBytes(StandardCharsets.UTF_8);
final byte[] hello = "Hello".getBytes(StandardCharsets.UTF_8);
final AtomicBoolean boolRef = new AtomicBoolean();
// limit = length
- bounded = new BoundedInputStream(new ByteArrayInputStream(helloWorld), helloWorld.length) {
+ BoundedInputStream bounded = new BoundedInputStream(new ByteArrayInputStream(helloWorld), helloWorld.length) {
@Override
protected void onMaxLength(final long max, final long readCount) {
boolRef.set(true);