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 dce89548558b615938f2c1635c1c8d2edb88020d Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Thu May 5 14:12:31 2022 -0400 Fix broken tests. --- .../org/apache/commons/compress/ArchiveUtilsTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java b/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java index abcb7e3f..5daf8a30 100644 --- a/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java +++ b/src/test/java/org/apache/commons/compress/ArchiveUtilsTest.java @@ -18,16 +18,17 @@ package org.apache.commons.compress; -import org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry; -import org.apache.commons.compress.utils.ArchiveUtils; -import org.junit.jupiter.api.Test; - import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; +import org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry; +import org.apache.commons.compress.utils.ArchiveUtils; +import org.junit.jupiter.api.Test; + public class ArchiveUtilsTest extends AbstractTestCase { private static final int bytesToTest = 50; @@ -74,6 +75,7 @@ public class ArchiveUtilsTest extends AbstractTestCase { @Test public void sanitizeShortensString() { + // @formatter:off final String input = "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" @@ -84,6 +86,7 @@ public class ArchiveUtilsTest extends AbstractTestCase { + "012345678901234567890123456789012345678901234567890123456789" + "012345678901234567890123456789012345678901234567890123456789" + "012345678901..."; + // @formatter:on assertEquals(expected, ArchiveUtils.sanitize(input)); } @@ -140,11 +143,8 @@ public class ArchiveUtilsTest extends AbstractTestCase { @Test public void testToAsciiStringThrowsStringIndexOutOfBoundsException() { - final byte[] byteArray = new byte[3]; - - ArchiveUtils.toAsciiString(byteArray, 940, 2730); - + assertThrows(StringIndexOutOfBoundsException.class, () -> ArchiveUtils.toAsciiString(byteArray, 940, 2730)); } private void asciiToByteAndBackOK(final String inputString) {