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 e32b436b Sort members e32b436b is described below commit e32b436b188ad6e1aafb85307b50322012d88c44 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun May 21 08:22:27 2023 -0400 Sort members --- .../commons/io/input/AutoCloseInputStreamTest.java | 48 +++++++++++----------- .../commons/io/input/XmlStreamReaderTest.java | 10 ++--- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java b/src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java index ca67b2b5..34b98bfe 100644 --- a/src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java +++ b/src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java @@ -105,16 +105,28 @@ public class AutoCloseInputStreamTest { assertEquals(-1, stream.read(b, 0, b.length), "read(b, off, len)"); } - @Test - public void testResetBeforeEndCtor() throws IOException { - try (final AutoCloseInputStream inputStream = new AutoCloseInputStream(new ByteArrayInputStream("1234".getBytes()))) { - testResetBeforeEnd(inputStream); - } + private void testResetBeforeEnd(final AutoCloseInputStream inputStream) throws IOException { + 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()); } @Test - public void testResetBeforeEndSetInputStream() throws IOException { - try (final AutoCloseInputStream inputStream = AutoCloseInputStream.builder().setInputStream(new ByteArrayInputStream("1234".getBytes())).get()) { + public void testResetBeforeEndCtor() throws IOException { + try (final AutoCloseInputStream inputStream = new AutoCloseInputStream(new ByteArrayInputStream("1234".getBytes()))) { testResetBeforeEnd(inputStream); } } @@ -133,23 +145,11 @@ public class AutoCloseInputStreamTest { } } - private void testResetBeforeEnd(final AutoCloseInputStream inputStream) throws IOException { - 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()); + @Test + public void testResetBeforeEndSetInputStream() throws IOException { + try (final AutoCloseInputStream inputStream = AutoCloseInputStream.builder().setInputStream(new ByteArrayInputStream("1234".getBytes())).get()) { + testResetBeforeEnd(inputStream); + } } } diff --git a/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java b/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java index e57da885..026ea4f0 100644 --- a/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java +++ b/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java @@ -205,6 +205,11 @@ public class XmlStreamReaderTest { } } + @Test + protected void testConstructorFileInputNull() { + assertThrows(NullPointerException.class, () -> new XmlStreamReader((File) null)); + } + @Test protected void testConstructorFileInputOpenOptions() throws IOException { try (XmlStreamReader reader = new XmlStreamReader(new File("pom.xml"))) { @@ -215,11 +220,6 @@ public class XmlStreamReaderTest { } } - @Test - protected void testConstructorFileInputNull() { - assertThrows(NullPointerException.class, () -> new XmlStreamReader((File) null)); - } - @Test protected void testConstructorInputStreamInput() throws IOException { final Path path = Paths.get("pom.xml");