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-compress.git
commit 51c68bef1dd80530b52ee115b85955a743bf63ff Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Thu May 5 14:08:02 2022 -0400 Sort members. --- .../archivers/cpio/CpioArchiveInputStreamTest.java | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java index 256aaf89..7b17f456 100644 --- a/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java @@ -31,6 +31,27 @@ import org.junit.jupiter.api.Test; public class CpioArchiveInputStreamTest extends AbstractTestCase { + @Test + public void multiByteReadConsistentlyReturnsMinusOneAtEof() throws Exception { + final byte[] buf = new byte[2]; + try (InputStream in = Files.newInputStream(getFile("bla.cpio").toPath()); CpioArchiveInputStream archive = new CpioArchiveInputStream(in)) { + final ArchiveEntry e = archive.getNextEntry(); + IOUtils.toByteArray(archive); + assertEquals(-1, archive.read(buf)); + assertEquals(-1, archive.read(buf)); + } + } + + @Test + public void singleByteReadConsistentlyReturnsMinusOneAtEof() throws Exception { + try (InputStream in = Files.newInputStream(getFile("bla.cpio").toPath()); CpioArchiveInputStream archive = new CpioArchiveInputStream(in)) { + final ArchiveEntry e = archive.getNextEntry(); + IOUtils.toByteArray(archive); + assertEquals(-1, archive.read()); + assertEquals(-1, archive.read()); + } + } + @Test public void testCpioUnarchive() throws Exception { final StringBuilder expected = new StringBuilder(); @@ -83,25 +104,4 @@ public class CpioArchiveInputStreamTest extends AbstractTestCase { assertEquals(2, count); } - @Test - public void singleByteReadConsistentlyReturnsMinusOneAtEof() throws Exception { - try (InputStream in = Files.newInputStream(getFile("bla.cpio").toPath()); CpioArchiveInputStream archive = new CpioArchiveInputStream(in)) { - final ArchiveEntry e = archive.getNextEntry(); - IOUtils.toByteArray(archive); - assertEquals(-1, archive.read()); - assertEquals(-1, archive.read()); - } - } - - @Test - public void multiByteReadConsistentlyReturnsMinusOneAtEof() throws Exception { - final byte[] buf = new byte[2]; - try (InputStream in = Files.newInputStream(getFile("bla.cpio").toPath()); CpioArchiveInputStream archive = new CpioArchiveInputStream(in)) { - final ArchiveEntry e = archive.getNextEntry(); - IOUtils.toByteArray(archive); - assertEquals(-1, archive.read(buf)); - assertEquals(-1, archive.read(buf)); - } - } - }