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


The following commit(s) were added to refs/heads/master by this push:
     new c83f29606 Use Java 7 API
c83f29606 is described below

commit c83f296060ea19b43be7f45acadbaefc3ecf842a
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Tue Apr 8 08:43:07 2025 -0400

    Use Java 7 API
---
 .../io/input/ReversedLinesFileReaderParamFileTest.java        | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderParamFileTest.java
 
b/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderParamFileTest.java
index c47888823..010785e06 100644
--- 
a/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderParamFileTest.java
+++ 
b/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderParamFileTest.java
@@ -18,7 +18,6 @@
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.Reader;
 import java.io.Writer;
@@ -29,6 +28,7 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.List;
 import java.util.Stack;
 import java.util.stream.Stream;
 
@@ -87,14 +87,9 @@ public static Stream<Arguments> 
testDataIntegrityWithBufferedReader() throws IOE
 
     private void testDataIntegrityWithBufferedReader(final Path filePath, 
final FileSystem fileSystem, final Charset charset,
             final ReversedLinesFileReader reversedLinesFileReader) throws 
IOException {
+        final List<String> allLines = Files.readAllLines(filePath, 
Charsets.toCharset(charset));
         final Stack<String> lineStack = new Stack<>();
-        try (BufferedReader bufferedReader = Files.newBufferedReader(filePath, 
Charsets.toCharset(charset))) {
-            // read all lines in normal order
-            String line;
-            while ((line = bufferedReader.readLine()) != null) {
-                lineStack.push(line);
-            }
-        }
+        lineStack.addAll(allLines);
         // read in reverse order and compare with lines from stack
         reversedLinesFileReader.forEach(line -> assertEquals(lineStack.pop(), 
line));
         assertEquals(0, lineStack.size(), "Stack should be empty");

Reply via email to