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
commit 305c003f1cc19a87f32e2dde081e906d3d318c45 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Mon Jul 8 22:05:11 2024 -0400 Pull up ReadAheadInputStreamTest.testAvailableAfterOpen() --- .../commons/io/input/AbstractInputStreamTest.java | 23 ++++++++++++++-------- .../commons/io/input/ReadAheadInputStreamTest.java | 10 ---------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/test/java/org/apache/commons/io/input/AbstractInputStreamTest.java b/src/test/java/org/apache/commons/io/input/AbstractInputStreamTest.java index 1d4e98cdb..b240ab303 100644 --- a/src/test/java/org/apache/commons/io/input/AbstractInputStreamTest.java +++ b/src/test/java/org/apache/commons/io/input/AbstractInputStreamTest.java @@ -40,16 +40,20 @@ import org.junit.jupiter.api.Test; */ public abstract class AbstractInputStreamTest { + static final String ARRAY_LENGTHS_NAME = "org.apache.commons.io.input.AbstractInputStreamTest#getArrayLengths"; + + static final int[] ARRAY_LENGTHS = { 0, 1, 2, 4, 8, 16, 32, 64, 128 }; + + static int[] getArrayLengths() { + return ARRAY_LENGTHS; + } + private byte[] randomBytes; protected Path inputFile; protected InputStream[] inputStreams; - static final String ARRAY_LENGTHS_NAME = "org.apache.commons.io.input.AbstractInputStreamTest#getArrayLengths"; - - static final int[] ARRAY_LENGTHS = { 0, 1, 2, 4, 8, 16, 32, 64, 128 }; - @BeforeEach public void setUp() throws IOException { // Create a byte array of size 2 MB with random bytes @@ -72,6 +76,13 @@ public abstract class AbstractInputStreamTest { } } + @Test + public void testAvailableAfterOpen() throws Exception { + for (final InputStream inputStream : inputStreams) { + assertEquals(0, inputStream.available()); + } + } + @Test public void testAvailableAfterRead() throws Exception { for (final InputStream inputStream : inputStreams) { @@ -181,8 +192,4 @@ public abstract class AbstractInputStreamTest { } } } - - static int[] getArrayLengths() { - return ARRAY_LENGTHS; - } } diff --git a/src/test/java/org/apache/commons/io/input/ReadAheadInputStreamTest.java b/src/test/java/org/apache/commons/io/input/ReadAheadInputStreamTest.java index 59145f52b..26ae19cef 100644 --- a/src/test/java/org/apache/commons/io/input/ReadAheadInputStreamTest.java +++ b/src/test/java/org/apache/commons/io/input/ReadAheadInputStreamTest.java @@ -16,14 +16,11 @@ */ package org.apache.commons.io.input; -import static org.junit.jupiter.api.Assertions.assertEquals; - import java.io.IOException; import java.io.InputStream; import java.nio.file.StandardOpenOption; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; /** * Tests {@link ReadAheadInputStream}. @@ -62,11 +59,4 @@ public class ReadAheadInputStreamTest extends AbstractInputStreamTest { ReadAheadInputStream.builder().setPath(inputFile).setOpenOptions(StandardOpenOption.READ).get() }; } - @Test - public void testAvailableAfterOpen() throws Exception { - for (final InputStream inputStream : inputStreams) { - assertEquals(0, inputStream.available()); - } - } - }