Add test case related to
MODIFY
src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java
src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java
@@ -57,7 +57,6 @@ public void testClose() throws IOException {
assertEquals(-1, stream.read(), "read()");
}
-
@Test
public void testRead() throws IOException {
for (final byte element : data) {
@@ -100,4 +99,26 @@ public void testReadBufferOffsetLength() throws IOException {
assertEquals(-1, stream.read(b, 0, b.length), "read(b, off, len)");
}
+ @Test
+ public void testResetBeforeEnd() throws IOException {
+ final String inputStr = "1234";
+ AutoCloseInputStream inputStream = new AutoCloseInputStream(new ByteArrayInputStream(inputStr.getBytes()));
+ inputStream.mark(1);
+ assertEquals('1', inputStream.read());
+ inputStream.reset();
+ assertEquals('1', inputStream.read());
+ assertEquals('2', inputStream.read());
+ inputStream.reset();
+ assertEquals('1', inputStream.read());
+ assertEquals('2', inputStream.read());
+ assertEquals('3', inputStream.read());
+ inputStream.reset();
+ assertEquals('1', inputStream.read());
+ assertEquals('2', inputStream.read());
+ assertEquals('3', inputStream.read());
+ assertEquals('4', inputStream.read());
+ inputStream.reset();
+ assertEquals('1', inputStream.read());
+ }
+
}

Add test case related to [IO-568].