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
The following commit(s) were added to refs/heads/master by this push: new 0928e857c Sort members 0928e857c is described below commit 0928e857cbd6f248fe92f7ca068e831e62deec6a Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue Nov 14 16:45:00 2023 -0500 Sort members --- .../archivers/ar/ArArchiveInputStreamTest.java | 52 +++++++++++----------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java index 2b2bd7d3e..ba2d85332 100644 --- a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStreamTest.java @@ -75,6 +75,32 @@ public class ArArchiveInputStreamTest extends AbstractTest { } } + @Test + public void testInvalidBadTableLength() throws Exception { + try (InputStream in = newInputStream("org/apache/commons/compress/ar/number_parsing/bad_table_length_gnu.ar"); + ArArchiveInputStream archive = new ArArchiveInputStream(in)) { + assertThrows(IOException.class, archive::getNextEntry); + } + } + + @ParameterizedTest + @ValueSource(strings = {"bad_long_namelen_bsd.ar", "bad_long_namelen_gnu1.ar", "bad_long_namelen_gnu2.ar", "bad_long_namelen_gnu3.ar", "bad_table_length_gnu.ar"}) + public void testInvalidLongNameLength(final String testFileName) throws Exception { + try (InputStream in = newInputStream("org/apache/commons/compress/ar/number_parsing/" + testFileName); + ArArchiveInputStream archive = new ArArchiveInputStream(in)) { + assertThrows(IOException.class, archive::getNextEntry); + } + } + + @ParameterizedTest + @ValueSource(strings = {"bad_group.ar", "bad_length.ar", "bad_modified.ar", "bad_user.ar"}) + public void testInvalidNumericFields(final String testFileName) throws Exception { + try (InputStream in = newInputStream("org/apache/commons/compress/ar/number_parsing/" + testFileName); + ArArchiveInputStream archive = new ArArchiveInputStream(in)) { + assertThrows(IOException.class, archive::getNextEntry); + } + } + @Test public void testMultiByteReadConsistentlyReturnsMinusOneAtEof() throws Exception { final byte[] buf = new byte[2]; @@ -137,30 +163,4 @@ public class ArArchiveInputStreamTest extends AbstractTest { } } - @ParameterizedTest - @ValueSource(strings = {"bad_group.ar", "bad_length.ar", "bad_modified.ar", "bad_user.ar"}) - public void testInvalidNumericFields(final String testFileName) throws Exception { - try (InputStream in = newInputStream("org/apache/commons/compress/ar/number_parsing/" + testFileName); - ArArchiveInputStream archive = new ArArchiveInputStream(in)) { - assertThrows(IOException.class, archive::getNextEntry); - } - } - - @ParameterizedTest - @ValueSource(strings = {"bad_long_namelen_bsd.ar", "bad_long_namelen_gnu1.ar", "bad_long_namelen_gnu2.ar", "bad_long_namelen_gnu3.ar", "bad_table_length_gnu.ar"}) - public void testInvalidLongNameLength(final String testFileName) throws Exception { - try (InputStream in = newInputStream("org/apache/commons/compress/ar/number_parsing/" + testFileName); - ArArchiveInputStream archive = new ArArchiveInputStream(in)) { - assertThrows(IOException.class, archive::getNextEntry); - } - } - - @Test - public void testInvalidBadTableLength() throws Exception { - try (InputStream in = newInputStream("org/apache/commons/compress/ar/number_parsing/bad_table_length_gnu.ar"); - ArArchiveInputStream archive = new ArArchiveInputStream(in)) { - assertThrows(IOException.class, archive::getNextEntry); - } - } - }