You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/07/08 12:46:06 UTC
(commons-io) 03/04: Pull up BufferedFileChannelInputStreamTest's testAvailableAfterClose() and testAvailableAfterRead()
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 bd706ae09ea8fac2a83a8cf8c97267b0828819f8
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jul 8 08:43:56 2024 -0400
Pull up BufferedFileChannelInputStreamTest's testAvailableAfterClose()
and testAvailableAfterRead()
---
.../commons/io/input/AbstractInputStreamTest.java | 18 ++++++++++++++++++
.../io/input/BufferedFileChannelInputStreamTest.java | 17 -----------------
2 files changed, 18 insertions(+), 17 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 182d014b4..f8b8bdc6e 100644
--- a/src/test/java/org/apache/commons/io/input/AbstractInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/AbstractInputStreamTest.java
@@ -17,6 +17,8 @@
package org.apache.commons.io.input;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.io.InputStream;
@@ -58,6 +60,22 @@ public abstract class AbstractInputStreamTest {
IOUtils.close(inputStreams);
}
+ @Test
+ public void testAvailableAfterClose() throws Exception {
+ for (final InputStream inputStream : inputStreams) {
+ inputStream.close();
+ assertEquals(0, inputStream.available());
+ }
+ }
+
+ @Test
+ public void testAvailableAfterRead() throws Exception {
+ for (final InputStream inputStream : inputStreams) {
+ assertNotEquals(IOUtils.EOF, inputStream.read());
+ assertTrue(inputStream.available() > 0);
+ }
+ }
+
@Test
public void testBytesSkipped() throws IOException {
for (final InputStream inputStream : inputStreams) {
diff --git a/src/test/java/org/apache/commons/io/input/BufferedFileChannelInputStreamTest.java b/src/test/java/org/apache/commons/io/input/BufferedFileChannelInputStreamTest.java
index 4ebd2a4ab..55cd1ef0b 100644
--- a/src/test/java/org/apache/commons/io/input/BufferedFileChannelInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/BufferedFileChannelInputStreamTest.java
@@ -17,7 +17,6 @@
package org.apache.commons.io.input;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -54,14 +53,6 @@ public class BufferedFileChannelInputStreamTest extends AbstractInputStreamTest
//@formatter:on
}
- @Test
- public void testAvailableAfterClose() throws Exception {
- for (final InputStream inputStream : inputStreams) {
- inputStream.close();
- assertEquals(0, inputStream.available());
- }
- }
-
@Test
public void testAvailableAfterOpen() throws Exception {
for (final InputStream inputStream : inputStreams) {
@@ -69,14 +60,6 @@ public class BufferedFileChannelInputStreamTest extends AbstractInputStreamTest
}
}
- @Test
- public void testAvailableAfterRead() throws Exception {
- for (final InputStream inputStream : inputStreams) {
- assertNotEquals(IOUtils.EOF, inputStream.read());
- assertTrue(inputStream.available() > 0);
- }
- }
-
@Test
public void testBuilderGet() {
// java.lang.IllegalStateException: origin == null