garydgregory commented on code in PR #860:
URL: https://github.com/apache/commons-io/pull/860#discussion_r3430569473


##########
src/test/java/org/apache/commons/io/input/BoundedReaderTest.java:
##########
@@ -242,4 +243,42 @@ void testSkipTest() throws IOException {
             assertEquals(-1, mr.read());
         }
     }
+
+    @Test
+    void testSkipDoesNotExceedBound() throws IOException {
+        try (BoundedReader mr = new BoundedReader(new 
StringReader("01234567890"), 3)) {
+            assertEquals(3, mr.skip(100));
+            assertEquals(-1, mr.read());
+        }
+    }
+
+    @Test
+    void testSkipDoesNotOverflowCharsRead() throws IOException {
+        try (BoundedReader mr = new BoundedReader(new 
StringReader("01234567890"), 3)) {
+            assertEquals(3, mr.skip(Long.MAX_VALUE));
+            assertEquals(-1, mr.read());
+        }
+    }
+
+    @Test
+    void testSkipUsesActualSkippedCount() throws IOException {
+        try (BoundedReader mr = new BoundedReader(new FilterReader(new 
StringReader("01234567890")) {
+            @Override
+            public long skip(final long n) throws IOException {
+                return super.skip(Math.min(n, 2));
+            }
+        }, 5)) {
+            assertEquals(2, mr.skip(5));
+            assertEquals('2', mr.read());
+        }
+    }
+
+    @Test
+    void testSkipRespectsReadAheadLimit() throws IOException {
+        try (BoundedReader mr = new BoundedReader(new 
StringReader("01234567890"), 10)) {
+            mr.mark(3);

Review Comment:
   Hello @sarankumarbaskar 
   I don't think you understand what mark is supposed to do. Please read the 
docs and see if there's a real issue once you fix these new tests.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to