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 2a730ab8e1605fe88df4a219ac6b73a5c3bfa333
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Wed May 3 08:03:11 2023 -0400

    Sort members
---
 .../apache/commons/io/build/AbstractOrigin.java    | 46 ++++++-------
 .../commons/io/filefilter/WildcardFileFilter.java  |  4 +-
 .../commons/io/function/IOBinaryOperator.java      | 16 ++---
 .../org/apache/commons/io/function/IOStream.java   | 76 +++++++++++-----------
 .../apache/commons/io/input/BOMInputStream.java    | 10 +--
 .../input/MessageDigestCalculatingInputStream.java | 20 +++---
 .../commons/io/input/ReadAheadInputStream.java     |  4 +-
 .../apache/commons/io/output/XmlStreamWriter.java  |  4 +-
 .../java/org/apache/commons/io/IOUtilsTest.java    | 14 ++--
 .../apache/commons/io/function/IOStreamTest.java   | 42 ++++++------
 .../io/input/MemoryMappedFileInputStreamTest.java  |  8 +--
 .../io/input/RandomAccessFileInputStreamTest.java  | 32 ++++-----
 .../commons/io/input/ReaderInputStreamTest.java    | 20 +++---
 .../ReversedLinesFileReaderTestParamFile.java      | 48 +++++++-------
 .../commons/io/input/SequenceReaderTest.java       | 14 ++--
 .../UnsynchronizedBufferedInputStreamTest.java     |  8 +--
 .../input/UnsynchronizedFilterInputStreamTest.java |  4 +-
 17 files changed, 185 insertions(+), 185 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/build/AbstractOrigin.java 
b/src/main/java/org/apache/commons/io/build/AbstractOrigin.java
index cb793ab3..4c96c6e9 100644
--- a/src/main/java/org/apache/commons/io/build/AbstractOrigin.java
+++ b/src/main/java/org/apache/commons/io/build/AbstractOrigin.java
@@ -241,29 +241,6 @@ public abstract class AbstractOrigin<T, B extends 
AbstractOrigin<T, B>> extends
         return origin;
     }
 
-    /**
-     * Gets a new Reader on the origin, buffered by default.
-     *
-     * @param charset the charset to use for decoding
-     * @return a new Reader on the origin.
-     * @throws IOException if an I/O error occurs opening the file.
-     */
-    public Reader getReader(final Charset charset) throws IOException {
-        return Files.newBufferedReader(getPath(), charset);
-    }
-
-    /**
-     * Gets a new Writer on the origin, buffered by default.
-     *
-     * @param charset the charset to use for encoding
-     * @param options options specifying how the file is opened
-     * @return a new Writer on the origin.
-     * @throws IOException if an I/O error occurs opening or creating the file.
-     */
-    public Writer getWriter(final Charset charset, final OpenOption... 
options) throws IOException {
-        return Files.newBufferedWriter(getPath(), charset, options);
-    }
-
     /**
      * Gets this origin as a Path, if possible.
      *
@@ -304,6 +281,29 @@ public abstract class AbstractOrigin<T, B extends 
AbstractOrigin<T, B>> extends
         throw new UnsupportedOperationException(origin.toString());
     }
 
+    /**
+     * Gets a new Reader on the origin, buffered by default.
+     *
+     * @param charset the charset to use for decoding
+     * @return a new Reader on the origin.
+     * @throws IOException if an I/O error occurs opening the file.
+     */
+    public Reader getReader(final Charset charset) throws IOException {
+        return Files.newBufferedReader(getPath(), charset);
+    }
+
+    /**
+     * Gets a new Writer on the origin, buffered by default.
+     *
+     * @param charset the charset to use for encoding
+     * @param options options specifying how the file is opened
+     * @return a new Writer on the origin.
+     * @throws IOException if an I/O error occurs opening or creating the file.
+     */
+    public Writer getWriter(final Charset charset, final OpenOption... 
options) throws IOException {
+        return Files.newBufferedWriter(getPath(), charset, options);
+    }
+
     @Override
     public String toString() {
         return origin.toString();
diff --git 
a/src/main/java/org/apache/commons/io/filefilter/WildcardFileFilter.java 
b/src/main/java/org/apache/commons/io/filefilter/WildcardFileFilter.java
index b6a27bb6..df337acb 100644
--- a/src/main/java/org/apache/commons/io/filefilter/WildcardFileFilter.java
+++ b/src/main/java/org/apache/commons/io/filefilter/WildcardFileFilter.java
@@ -133,6 +133,8 @@ public class WildcardFileFilter extends AbstractFileFilter 
implements Serializab
 
     }
 
+    private static final long serialVersionUID = -7426486598995782105L;
+
     /**
      * Constructs a new {@link Builder}.
      *
@@ -143,8 +145,6 @@ public class WildcardFileFilter extends AbstractFileFilter 
implements Serializab
         return new Builder();
     }
 
-    private static final long serialVersionUID = -7426486598995782105L;
-
     private static <T> T requireWildcards(final T wildcards) {
         return Objects.requireNonNull(wildcards, "wildcards");
     }
diff --git a/src/main/java/org/apache/commons/io/function/IOBinaryOperator.java 
b/src/main/java/org/apache/commons/io/function/IOBinaryOperator.java
index e91d6481..5680d30a 100644
--- a/src/main/java/org/apache/commons/io/function/IOBinaryOperator.java
+++ b/src/main/java/org/apache/commons/io/function/IOBinaryOperator.java
@@ -35,33 +35,33 @@ import java.util.function.BinaryOperator;
 public interface IOBinaryOperator<T> extends IOBiFunction<T, T, T> {
 
     /**
-     * Creates a {@link IOBinaryOperator} which returns the lesser of two 
elements according to the specified
+     * Creates a {@link IOBinaryOperator} which returns the greater of two 
elements according to the specified
      * {@code Comparator}.
      *
      * @param <T> the type of the input arguments of the comparator
      * @param comparator a {@code Comparator} for comparing the two values
-     * @return a {@code BinaryOperator} which returns the lesser of its 
operands, according to the supplied
+     * @return a {@code BinaryOperator} which returns the greater of its 
operands, according to the supplied
      *         {@code Comparator}
      * @throws NullPointerException if the argument is null
      */
-    static <T> IOBinaryOperator<T> minBy(final IOComparator<? super T> 
comparator) {
+    static <T> IOBinaryOperator<T> maxBy(final IOComparator<? super T> 
comparator) {
         Objects.requireNonNull(comparator);
-        return (a, b) -> comparator.compare(a, b) <= 0 ? a : b;
+        return (a, b) -> comparator.compare(a, b) >= 0 ? a : b;
     }
 
     /**
-     * Creates a {@link IOBinaryOperator} which returns the greater of two 
elements according to the specified
+     * Creates a {@link IOBinaryOperator} which returns the lesser of two 
elements according to the specified
      * {@code Comparator}.
      *
      * @param <T> the type of the input arguments of the comparator
      * @param comparator a {@code Comparator} for comparing the two values
-     * @return a {@code BinaryOperator} which returns the greater of its 
operands, according to the supplied
+     * @return a {@code BinaryOperator} which returns the lesser of its 
operands, according to the supplied
      *         {@code Comparator}
      * @throws NullPointerException if the argument is null
      */
-    static <T> IOBinaryOperator<T> maxBy(final IOComparator<? super T> 
comparator) {
+    static <T> IOBinaryOperator<T> minBy(final IOComparator<? super T> 
comparator) {
         Objects.requireNonNull(comparator);
-        return (a, b) -> comparator.compare(a, b) >= 0 ? a : b;
+        return (a, b) -> comparator.compare(a, b) <= 0 ? a : b;
     }
 
     /**
diff --git a/src/main/java/org/apache/commons/io/function/IOStream.java 
b/src/main/java/org/apache/commons/io/function/IOStream.java
index 116a7a42..5e78e6c9 100644
--- a/src/main/java/org/apache/commons/io/function/IOStream.java
+++ b/src/main/java/org/apache/commons/io/function/IOStream.java
@@ -73,44 +73,6 @@ public interface IOStream<T> extends IOBaseStream<T, 
IOStream<T>, Stream<T>> {
         return IOStreamAdapter.adapt(Stream.empty());
     }
 
-    /**
-     * Performs an action for each element gathering any exceptions.
-     *
-     * @param action The action to apply to each element.
-     * @throws IOExceptionList if any I/O errors occur.
-     */
-    default void forAll(final IOConsumer<T> action) throws IOExceptionList {
-        forAll(action, (i, e) -> e);
-    }
-
-    /**
-     * Performs an action for each element gathering any exceptions.
-     *
-     * @param action The action to apply to each element.
-     * @param exSupplier The exception supplier.
-     * @throws IOExceptionList if any I/O errors occur.
-     */
-    default void forAll(final IOConsumer<T> action, final BiFunction<Integer, 
IOException, IOException> exSupplier) throws IOExceptionList {
-        final AtomicReference<List<IOException>> causeList = new 
AtomicReference<>();
-        final AtomicInteger index = new AtomicInteger();
-        final IOConsumer<T> safeAction = IOStreams.toIOConsumer(action);
-        unwrap().forEach(e -> {
-            try {
-                safeAction.accept(e);
-            } catch (final IOException innerEx) {
-                if (causeList.get() == null) {
-                    // Only allocate if required
-                    causeList.set(new ArrayList<>());
-                }
-                if (exSupplier != null) {
-                    causeList.get().add(exSupplier.apply(index.get(), 
innerEx));
-                }
-            }
-            index.incrementAndGet();
-        });
-        IOExceptionList.checkEmpty(causeList.get(), null);
-    }
-
     /**
      * Like {@link Stream#iterate(Object, UnaryOperator)} but for IO.
      *
@@ -352,6 +314,44 @@ public interface IOStream<T> extends IOBaseStream<T, 
IOStream<T>, Stream<T>> {
         return unwrap().flatMapToLong(t -> Erase.apply(mapper, t));
     }
 
+    /**
+     * Performs an action for each element gathering any exceptions.
+     *
+     * @param action The action to apply to each element.
+     * @throws IOExceptionList if any I/O errors occur.
+     */
+    default void forAll(final IOConsumer<T> action) throws IOExceptionList {
+        forAll(action, (i, e) -> e);
+    }
+
+    /**
+     * Performs an action for each element gathering any exceptions.
+     *
+     * @param action The action to apply to each element.
+     * @param exSupplier The exception supplier.
+     * @throws IOExceptionList if any I/O errors occur.
+     */
+    default void forAll(final IOConsumer<T> action, final BiFunction<Integer, 
IOException, IOException> exSupplier) throws IOExceptionList {
+        final AtomicReference<List<IOException>> causeList = new 
AtomicReference<>();
+        final AtomicInteger index = new AtomicInteger();
+        final IOConsumer<T> safeAction = IOStreams.toIOConsumer(action);
+        unwrap().forEach(e -> {
+            try {
+                safeAction.accept(e);
+            } catch (final IOException innerEx) {
+                if (causeList.get() == null) {
+                    // Only allocate if required
+                    causeList.set(new ArrayList<>());
+                }
+                if (exSupplier != null) {
+                    causeList.get().add(exSupplier.apply(index.get(), 
innerEx));
+                }
+            }
+            index.incrementAndGet();
+        });
+        IOExceptionList.checkEmpty(causeList.get(), null);
+    }
+
     /**
      * Like {@link Stream#forEach(java.util.function.Consumer)} but throws 
{@link IOException}.
      *
diff --git a/src/main/java/org/apache/commons/io/input/BOMInputStream.java 
b/src/main/java/org/apache/commons/io/input/BOMInputStream.java
index 495ba885..918d9945 100644
--- a/src/main/java/org/apache/commons/io/input/BOMInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/BOMInputStream.java
@@ -109,7 +109,12 @@ public class BOMInputStream extends ProxyInputStream {
 
         private static final ByteOrderMark[] DEFAULT = { ByteOrderMark.UTF_8 };
 
+        // for test access
+        static ByteOrderMark getDefaultBOM() {
+            return DEFAULT[0];
+        }
         private boolean include;
+
         private ByteOrderMark[] byteOrderMarks = DEFAULT;
 
         @SuppressWarnings("resource")
@@ -140,11 +145,6 @@ public class BOMInputStream extends ProxyInputStream {
             return this;
         }
 
-        // for test access
-        static ByteOrderMark getDefaultBOM() {
-            return DEFAULT[0];
-        }
-
     }
 
     /**
diff --git 
a/src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
 
b/src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
index 51ebd2b3..86c1af02 100644
--- 
a/src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
+++ 
b/src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
@@ -96,16 +96,6 @@ public class MessageDigestCalculatingInputStream extends 
ObservableInputStream {
 
     }
 
-    /**
-     * Constructs a new {@link Builder}.
-     *
-     * @return a new {@link Builder}.
-     * @since 2.12.0
-     */
-    public static Builder builder() {
-        return new Builder();
-    }
-
     /**
      * Maintains the message digest.
      */
@@ -140,6 +130,16 @@ public class MessageDigestCalculatingInputStream extends 
ObservableInputStream {
      */
     private static final String DEFAULT_ALGORITHM = "MD5";
 
+    /**
+     * Constructs a new {@link Builder}.
+     *
+     * @return a new {@link Builder}.
+     * @since 2.12.0
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
     /**
      * Gets a MessageDigest object that implements the default digest 
algorithm.
      *
diff --git 
a/src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java 
b/src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java
index 4840ceb8..6d117e7b 100644
--- a/src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java
@@ -82,6 +82,8 @@ public class ReadAheadInputStream extends InputStream {
 
     }
 
+    private static final ThreadLocal<byte[]> BYTE_ARRAY_1 = 
ThreadLocal.withInitial(() -> new byte[1]);
+
     /**
      * Constructs a new {@link Builder}.
      *
@@ -92,8 +94,6 @@ public class ReadAheadInputStream extends InputStream {
         return new Builder();
     }
 
-    private static final ThreadLocal<byte[]> BYTE_ARRAY_1 = 
ThreadLocal.withInitial(() -> new byte[1]);
-
     /**
      * Creates a new daemon executor service.
      *
diff --git a/src/main/java/org/apache/commons/io/output/XmlStreamWriter.java 
b/src/main/java/org/apache/commons/io/output/XmlStreamWriter.java
index c42581a4..d0f659d1 100644
--- a/src/main/java/org/apache/commons/io/output/XmlStreamWriter.java
+++ b/src/main/java/org/apache/commons/io/output/XmlStreamWriter.java
@@ -73,6 +73,8 @@ public class XmlStreamWriter extends Writer {
 
     }
 
+    private static final int BUFFER_SIZE = IOUtils.DEFAULT_BUFFER_SIZE;
+
     /**
      * Constructs a new {@link Builder}.
      *
@@ -83,8 +85,6 @@ public class XmlStreamWriter extends Writer {
         return new Builder();
     }
 
-    private static final int BUFFER_SIZE = IOUtils.DEFAULT_BUFFER_SIZE;
-
     private final OutputStream out;
 
     private final Charset defaultCharset;
diff --git a/src/test/java/org/apache/commons/io/IOUtilsTest.java 
b/src/test/java/org/apache/commons/io/IOUtilsTest.java
index 4fdc91c3..dd988b2e 100644
--- a/src/test/java/org/apache/commons/io/IOUtilsTest.java
+++ b/src/test/java/org/apache/commons/io/IOUtilsTest.java
@@ -301,6 +301,11 @@ public class IOUtilsTest {
         }
     }
 
+    @Test
+    public void testByteArrayWithNegativeSize() {
+        assertThrows(NegativeArraySizeException.class, () -> 
IOUtils.byteArray(-1));
+    }
+
     @Test
     public void testClose() {
         assertDoesNotThrow(() -> IOUtils.close((Closeable) null));
@@ -1152,6 +1157,8 @@ public class IOUtilsTest {
         assertEquals(fileSize, content.getBytes().length);
     }
 
+    // Tests from IO-305
+
     @Test
     public void 
testResourceToString_ExistingResourceAtSubPackage_WithClassLoader() throws 
Exception {
         final long fileSize = 
TestResources.getFile("FileUtilsTestDataCR.dat").length();
@@ -1162,8 +1169,6 @@ public class IOUtilsTest {
         assertEquals(fileSize, content.getBytes().length);
     }
 
-    // Tests from IO-305
-
     @Test
     public void testResourceToString_NonExistingResource() {
         assertThrows(IOException.class,
@@ -1729,9 +1734,4 @@ public class IOUtilsTest {
         }
     }
 
-    @Test
-    public void testByteArrayWithNegativeSize() {
-        assertThrows(NegativeArraySizeException.class, () -> 
IOUtils.byteArray(-1));
-    }
-
 }
diff --git a/src/test/java/org/apache/commons/io/function/IOStreamTest.java 
b/src/test/java/org/apache/commons/io/function/IOStreamTest.java
index 1080cc62..4fb8abe3 100644
--- a/src/test/java/org/apache/commons/io/function/IOStreamTest.java
+++ b/src/test/java/org/apache/commons/io/function/IOStreamTest.java
@@ -209,21 +209,6 @@ public class IOStreamTest {
         assertEquals('A' + 'B', IOStream.of("A", "B").flatMapToLong(e -> 
LongStream.of(e.charAt(0))).sum());
     }
 
-    @SuppressWarnings("resource") // custom stream not recognized by compiler 
warning machinery
-    @Test
-    public void testForEachIOConsumerOfQsuperT() throws IOException {
-        // compile vs type
-        assertThrows(IOException.class, () -> 
IOStream.of("A").forEach(TestUtils.throwingIOConsumer()));
-        // compile vs inlnine
-        assertThrows(IOException.class, () -> IOStream.of("A").forEach(e -> {
-            throw new IOException("Failure");
-        }));
-        assertThrows(IOException.class, () -> IOStream.of("A", 
"B").forEach(TestUtils.throwingIOConsumer()));
-        final StringBuilder sb = new StringBuilder();
-        IOStream.of("A", "B").forEachOrdered(sb::append);
-        assertEquals("AB", sb.toString());
-    }
-
     @SuppressWarnings("resource") // custom stream not recognized by compiler 
warning machinery
     @Test
     public void testForaAllIOConsumer() throws IOException {
@@ -269,6 +254,21 @@ public class IOStreamTest {
         assertEquals("AB", sb.toString());
     }
 
+    @SuppressWarnings("resource") // custom stream not recognized by compiler 
warning machinery
+    @Test
+    public void testForEachIOConsumerOfQsuperT() throws IOException {
+        // compile vs type
+        assertThrows(IOException.class, () -> 
IOStream.of("A").forEach(TestUtils.throwingIOConsumer()));
+        // compile vs inlnine
+        assertThrows(IOException.class, () -> IOStream.of("A").forEach(e -> {
+            throw new IOException("Failure");
+        }));
+        assertThrows(IOException.class, () -> IOStream.of("A", 
"B").forEach(TestUtils.throwingIOConsumer()));
+        final StringBuilder sb = new StringBuilder();
+        IOStream.of("A", "B").forEachOrdered(sb::append);
+        assertEquals("AB", sb.toString());
+    }
+
     @SuppressWarnings("resource") // custom stream not recognized by compiler 
warning machinery
     @Test
     public void testForEachOrdered() throws IOException {
@@ -374,12 +374,6 @@ public class IOStreamTest {
         assertEquals(2, IOStream.of("A", "B").count());
     }
 
-    @SuppressWarnings("resource") // custom stream not recognized by compiler 
warning machinery
-    @Test
-    public void testOfOne() {
-        assertEquals(1, IOStream.of("A").count());
-    }
-
     @SuppressWarnings("resource") // custom stream not recognized by compiler 
warning machinery
     @Test
     public void testOfIterable() {
@@ -391,6 +385,12 @@ public class IOStreamTest {
         assertEquals(2, IOStream.of(Arrays.asList("a", "b")).count());
     }
 
+    @SuppressWarnings("resource") // custom stream not recognized by compiler 
warning machinery
+    @Test
+    public void testOfOne() {
+        assertEquals(1, IOStream.of("A").count());
+    }
+
     @SuppressWarnings("resource") // custom stream not recognized by compiler 
warning machinery
     @Test
     public void testOnClose() throws IOException {
diff --git 
a/src/test/java/org/apache/commons/io/input/MemoryMappedFileInputStreamTest.java
 
b/src/test/java/org/apache/commons/io/input/MemoryMappedFileInputStreamTest.java
index 9eabf6a3..ce3c2d61 100644
--- 
a/src/test/java/org/apache/commons/io/input/MemoryMappedFileInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/io/input/MemoryMappedFileInputStreamTest.java
@@ -261,26 +261,26 @@ public class MemoryMappedFileInputStreamTest {
     }
 
     @Test
-    void testSmallPathBuilder() throws IOException {
+    void testSmallPath() throws IOException {
         // setup
         final Path file = createTestFile(100);
         final byte[] expectedData = Files.readAllBytes(file);
 
         // test
-        try (InputStream inputStream = 
MemoryMappedFileInputStream.builder().setPath(file).get()) {
+        try (InputStream inputStream = new MemoryMappedFileInputStream(file)) {
             // verify
             assertArrayEquals(expectedData, IOUtils.toByteArray(inputStream));
         }
     }
 
     @Test
-    void testSmallPath() throws IOException {
+    void testSmallPathBuilder() throws IOException {
         // setup
         final Path file = createTestFile(100);
         final byte[] expectedData = Files.readAllBytes(file);
 
         // test
-        try (InputStream inputStream = new MemoryMappedFileInputStream(file)) {
+        try (InputStream inputStream = 
MemoryMappedFileInputStream.builder().setPath(file).get()) {
             // verify
             assertArrayEquals(expectedData, IOUtils.toByteArray(inputStream));
         }
diff --git 
a/src/test/java/org/apache/commons/io/input/RandomAccessFileInputStreamTest.java
 
b/src/test/java/org/apache/commons/io/input/RandomAccessFileInputStreamTest.java
index d2f7605d..51ab0409 100644
--- 
a/src/test/java/org/apache/commons/io/input/RandomAccessFileInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/io/input/RandomAccessFileInputStreamTest.java
@@ -61,9 +61,9 @@ public class RandomAccessFileInputStreamTest {
 
     @SuppressWarnings("resource") // instance variable access
     @Test
-    public void testConstructorCloseOnCloseFalse() throws IOException {
+    public void testBuilderFile() throws IOException {
         try (RandomAccessFile file = createRandomAccessFile()) {
-            try (RandomAccessFileInputStream inputStream = new 
RandomAccessFileInputStream(file, false)) {
+            try (RandomAccessFileInputStream inputStream = 
RandomAccessFileInputStream.builder().setFile(new File(DATA_FILE)).get()) {
                 assertFalse(inputStream.isCloseOnClose());
                 assertNotEquals(-1, inputStream.getRandomAccessFile().read());
             }
@@ -73,21 +73,21 @@ public class RandomAccessFileInputStreamTest {
 
     @SuppressWarnings("resource") // instance variable access
     @Test
-    public void testConstructorCloseOnCloseTrue() throws IOException {
+    public void testBuilderPath() throws IOException {
         try (RandomAccessFile file = createRandomAccessFile()) {
-            try (RandomAccessFileInputStream inputStream = new 
RandomAccessFileInputStream(file, true)) {
-                assertTrue(inputStream.isCloseOnClose());
+            try (RandomAccessFileInputStream inputStream = 
RandomAccessFileInputStream.builder().setPath(Paths.get(DATA_FILE)).get()) {
+                assertFalse(inputStream.isCloseOnClose());
                 assertNotEquals(-1, inputStream.getRandomAccessFile().read());
             }
-            assertThrows(IOException.class, file::read);
+            file.read();
         }
     }
 
     @SuppressWarnings("resource") // instance variable access
     @Test
-    public void testConstructorRandomAccessFile() throws IOException {
+    public void testBuilderRandomAccessFile() throws IOException {
         try (RandomAccessFile file = createRandomAccessFile()) {
-            try (RandomAccessFileInputStream inputStream = new 
RandomAccessFileInputStream(file)) {
+            try (RandomAccessFileInputStream inputStream = 
RandomAccessFileInputStream.builder().setRandomAccessFile(file).get()) {
                 assertFalse(inputStream.isCloseOnClose());
                 assertNotEquals(-1, inputStream.getRandomAccessFile().read());
             }
@@ -97,9 +97,9 @@ public class RandomAccessFileInputStreamTest {
 
     @SuppressWarnings("resource") // instance variable access
     @Test
-    public void testBuilderRandomAccessFile() throws IOException {
+    public void testConstructorCloseOnCloseFalse() throws IOException {
         try (RandomAccessFile file = createRandomAccessFile()) {
-            try (RandomAccessFileInputStream inputStream = 
RandomAccessFileInputStream.builder().setRandomAccessFile(file).get()) {
+            try (RandomAccessFileInputStream inputStream = new 
RandomAccessFileInputStream(file, false)) {
                 assertFalse(inputStream.isCloseOnClose());
                 assertNotEquals(-1, inputStream.getRandomAccessFile().read());
             }
@@ -109,21 +109,21 @@ public class RandomAccessFileInputStreamTest {
 
     @SuppressWarnings("resource") // instance variable access
     @Test
-    public void testBuilderPath() throws IOException {
+    public void testConstructorCloseOnCloseTrue() throws IOException {
         try (RandomAccessFile file = createRandomAccessFile()) {
-            try (RandomAccessFileInputStream inputStream = 
RandomAccessFileInputStream.builder().setPath(Paths.get(DATA_FILE)).get()) {
-                assertFalse(inputStream.isCloseOnClose());
+            try (RandomAccessFileInputStream inputStream = new 
RandomAccessFileInputStream(file, true)) {
+                assertTrue(inputStream.isCloseOnClose());
                 assertNotEquals(-1, inputStream.getRandomAccessFile().read());
             }
-            file.read();
+            assertThrows(IOException.class, file::read);
         }
     }
 
     @SuppressWarnings("resource") // instance variable access
     @Test
-    public void testBuilderFile() throws IOException {
+    public void testConstructorRandomAccessFile() throws IOException {
         try (RandomAccessFile file = createRandomAccessFile()) {
-            try (RandomAccessFileInputStream inputStream = 
RandomAccessFileInputStream.builder().setFile(new File(DATA_FILE)).get()) {
+            try (RandomAccessFileInputStream inputStream = new 
RandomAccessFileInputStream(file)) {
                 assertFalse(inputStream.isCloseOnClose());
                 assertNotEquals(-1, inputStream.getRandomAccessFile().read());
             }
diff --git 
a/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java 
b/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
index 345c519e..b938e621 100644
--- a/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
@@ -256,16 +256,6 @@ public class ReaderInputStreamTest {
         testWithSingleByteRead(TEST_STRING, UTF_8);
     }
 
-    private void testWithBufferedRead(final String testString, final String 
charsetName) throws IOException {
-        final byte[] expected = testString.getBytes(charsetName);
-        try (ReaderInputStream in = new ReaderInputStream(new 
StringReader(testString), charsetName)) {
-            testWithBufferedRead(expected, in);
-        }
-        try (ReaderInputStream in = ReaderInputStream.builder().setReader(new 
StringReader(testString)).setCharset(charsetName).get()) {
-            testWithBufferedRead(expected, in);
-        }
-    }
-
     private void testWithBufferedRead(final byte[] expected, final 
ReaderInputStream in) throws IOException {
         final byte[] buffer = new byte[128];
         int offset = 0;
@@ -288,6 +278,16 @@ public class ReaderInputStreamTest {
         }
     }
 
+    private void testWithBufferedRead(final String testString, final String 
charsetName) throws IOException {
+        final byte[] expected = testString.getBytes(charsetName);
+        try (ReaderInputStream in = new ReaderInputStream(new 
StringReader(testString), charsetName)) {
+            testWithBufferedRead(expected, in);
+        }
+        try (ReaderInputStream in = ReaderInputStream.builder().setReader(new 
StringReader(testString)).setCharset(charsetName).get()) {
+            testWithBufferedRead(expected, in);
+        }
+    }
+
     private void testWithSingleByteRead(final String testString, final String 
charsetName) throws IOException {
         final byte[] bytes = testString.getBytes(charsetName);
         try (ReaderInputStream in = new ReaderInputStream(new 
StringReader(testString), charsetName)) {
diff --git 
a/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java
 
b/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java
index 8c9d0c5c..c4029a81 100644
--- 
a/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java
+++ 
b/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java
@@ -85,30 +85,6 @@ public class ReversedLinesFileReaderTestParamFile {
         // @formatter:on
     }
 
-    @ParameterizedTest(name = "{0}, encoding={1}, blockSize={2}, 
useNonDefaultFileSystem={3}, isResource={4}")
-    @MethodSource
-    public void testDataIntegrityWithBufferedReader(final String fileName, 
final String charsetName, final Integer blockSize,
-            final boolean useNonDefaultFileSystem, final boolean isResource) 
throws IOException, URISyntaxException {
-
-        Path filePath = isResource ? TestResources.getPath(fileName) : 
Paths.get(fileName);
-        FileSystem fileSystem = null;
-        if (useNonDefaultFileSystem) {
-            fileSystem = Jimfs.newFileSystem(Configuration.unix());
-            filePath = Files.copy(filePath, fileSystem.getPath("/" + 
fileName));
-        }
-
-        // We want to test null Charset in the 
ReversedLinesFileReaderconstructor.
-        final Charset charset = charsetName != null ? 
Charset.forName(charsetName) : null;
-        try (ReversedLinesFileReader reversedLinesFileReader = blockSize == 
null ? new ReversedLinesFileReader(filePath, charset)
-                : new ReversedLinesFileReader(filePath, blockSize, charset)) {
-            testDataIntegrityWithBufferedReader(filePath, fileSystem, charset, 
reversedLinesFileReader);
-        }
-        try (ReversedLinesFileReader reversedLinesFileReader = 
ReversedLinesFileReader.builder().setPath(filePath).setBufferSize(blockSize).setCharset(charset)
-                .get()) {
-            testDataIntegrityWithBufferedReader(filePath, fileSystem, charset, 
reversedLinesFileReader);
-        }
-    }
-
     private void testDataIntegrityWithBufferedReader(Path filePath, FileSystem 
fileSystem, final Charset charset,
             ReversedLinesFileReader reversedLinesFileReader) throws 
IOException {
         final Stack<String> lineStack = new Stack<>();
@@ -132,4 +108,28 @@ public class ReversedLinesFileReaderTestParamFile {
             fileSystem.close();
         }
     }
+
+    @ParameterizedTest(name = "{0}, encoding={1}, blockSize={2}, 
useNonDefaultFileSystem={3}, isResource={4}")
+    @MethodSource
+    public void testDataIntegrityWithBufferedReader(final String fileName, 
final String charsetName, final Integer blockSize,
+            final boolean useNonDefaultFileSystem, final boolean isResource) 
throws IOException, URISyntaxException {
+
+        Path filePath = isResource ? TestResources.getPath(fileName) : 
Paths.get(fileName);
+        FileSystem fileSystem = null;
+        if (useNonDefaultFileSystem) {
+            fileSystem = Jimfs.newFileSystem(Configuration.unix());
+            filePath = Files.copy(filePath, fileSystem.getPath("/" + 
fileName));
+        }
+
+        // We want to test null Charset in the 
ReversedLinesFileReaderconstructor.
+        final Charset charset = charsetName != null ? 
Charset.forName(charsetName) : null;
+        try (ReversedLinesFileReader reversedLinesFileReader = blockSize == 
null ? new ReversedLinesFileReader(filePath, charset)
+                : new ReversedLinesFileReader(filePath, blockSize, charset)) {
+            testDataIntegrityWithBufferedReader(filePath, fileSystem, charset, 
reversedLinesFileReader);
+        }
+        try (ReversedLinesFileReader reversedLinesFileReader = 
ReversedLinesFileReader.builder().setPath(filePath).setBufferSize(blockSize).setCharset(charset)
+                .get()) {
+            testDataIntegrityWithBufferedReader(filePath, fileSystem, charset, 
reversedLinesFileReader);
+        }
+    }
 }
diff --git a/src/test/java/org/apache/commons/io/input/SequenceReaderTest.java 
b/src/test/java/org/apache/commons/io/input/SequenceReaderTest.java
index 43efd071..99680959 100644
--- a/src/test/java/org/apache/commons/io/input/SequenceReaderTest.java
+++ b/src/test/java/org/apache/commons/io/input/SequenceReaderTest.java
@@ -47,13 +47,6 @@ public class SequenceReaderTest {
             }
         }
 
-        @Override
-        public int read(final char[] cbuf, final int off, final int len) 
throws IOException {
-            checkOpen();
-            close();
-            return EOF;
-        }
-
         @Override
         public void close() throws IOException {
             closed = true;
@@ -62,6 +55,13 @@ public class SequenceReaderTest {
         public boolean isClosed() {
             return closed;
         }
+
+        @Override
+        public int read(final char[] cbuf, final int off, final int len) 
throws IOException {
+            checkOpen();
+            close();
+            return EOF;
+        }
     };
 
     private static final char NUL = 0;
diff --git 
a/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java
 
b/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java
index 547f73c4..54d676e6 100644
--- 
a/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java
@@ -44,8 +44,6 @@ import org.junit.jupiter.api.Test;
  */
 public class UnsynchronizedBufferedInputStreamTest {
 
-    private static final int BUFFER_SIZE = 4096;
-
     static class MyUnsynchronizedBufferedInputStream extends 
UnsynchronizedBufferedInputStream {
         static byte[] buf;
 
@@ -60,6 +58,10 @@ public class UnsynchronizedBufferedInputStreamTest {
         }
     }
 
+    private static final int BUFFER_SIZE = 4096;
+
+    public static final String DATA = StringUtils.repeat("This is a test.", 
500);
+
     Path fileName;
 
     private BufferedInputStream is;
@@ -68,8 +70,6 @@ public class UnsynchronizedBufferedInputStreamTest {
 
     byte[] ibuf = new byte[BUFFER_SIZE];
 
-    public static final String DATA = StringUtils.repeat("This is a test.", 
500);
-
     /**
      * Sets up the fixture, for example, open a network connection. This 
method is called before a test is executed.
      *
diff --git 
a/src/test/java/org/apache/commons/io/input/UnsynchronizedFilterInputStreamTest.java
 
b/src/test/java/org/apache/commons/io/input/UnsynchronizedFilterInputStreamTest.java
index 005507d8..eb9a9786 100644
--- 
a/src/test/java/org/apache/commons/io/input/UnsynchronizedFilterInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/io/input/UnsynchronizedFilterInputStreamTest.java
@@ -45,14 +45,14 @@ public class UnsynchronizedFilterInputStreamTest {
         }
     }
 
+    public static final String DATA = StringUtils.repeat("This is a test.", 
500);
+
     private Path fileName;
 
     private InputStream is;
 
     byte[] ibuf = new byte[4096];
 
-    public static final String DATA = StringUtils.repeat("This is a test.", 
500);
-
     /**
      * Sets up the fixture, for example, open a network connection. This 
method is called before a test is executed.
      *


Reply via email to