This is an automated email from the ASF dual-hosted git repository. garydgregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-codec.git
commit e6ee5c8024d67ca89fb8d71d3c254353761ba2f0 Author: Gary Gregory <[email protected]> AuthorDate: Fri Sep 18 04:48:07 2026 -0700 Sort memebers --- .../apache/commons/codec/binary/Base45Test.java | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/test/java/org/apache/commons/codec/binary/Base45Test.java b/src/test/java/org/apache/commons/codec/binary/Base45Test.java index 9348c5b0..254e3a48 100644 --- a/src/test/java/org/apache/commons/codec/binary/Base45Test.java +++ b/src/test/java/org/apache/commons/codec/binary/Base45Test.java @@ -250,6 +250,22 @@ class Base45Test { assertThrows(IllegalArgumentException.class, () -> codec.decode(":6"), "Pair ':' '6' decodes to 314 which exceeds 255 and should be rejected"); } + /** + * Tests that non-alphabet whitespace is rejected, including within groups and at the start and end of the input. + */ + @ParameterizedTest + @ValueSource(strings = { "\r", "\n", "\t", "\r\n", "\u000B", "\f", "\u001C", "\u001D", "\u001E", "\u001F" }) + void testDecodeRejectsNonAlphabetWhitespace(final String whitespace) { + final Base45 codec = new Base45(); + assertThrows(IllegalArgumentException.class, () -> codec.decode(whitespace)); + final String encoded = "QED8WEX0"; + for (int i = 0; i <= encoded.length(); i++) { + final String input = encoded.substring(0, i) + whitespace + encoded.substring(i); + assertThrows(IllegalArgumentException.class, () -> codec.decode(input)); + assertThrows(IllegalArgumentException.class, () -> codec.decode(input.getBytes(StandardCharsets.US_ASCII))); + } + } + /** * Tests the RFC 9285 Section 4.4 decoding test vectors. */ @@ -281,22 +297,6 @@ class Base45Test { assertArrayEquals(new byte[] { 0 }, new Base45().decode("00")); } - /** - * Tests that non-alphabet whitespace is rejected, including within groups and at the start and end of the input. - */ - @ParameterizedTest - @ValueSource(strings = { "\r", "\n", "\t", "\r\n", "\u000B", "\f", "\u001C", "\u001D", "\u001E", "\u001F" }) - void testDecodeRejectsNonAlphabetWhitespace(final String whitespace) { - final Base45 codec = new Base45(); - assertThrows(IllegalArgumentException.class, () -> codec.decode(whitespace)); - final String encoded = "QED8WEX0"; - for (int i = 0; i <= encoded.length(); i++) { - final String input = encoded.substring(0, i) + whitespace + encoded.substring(i); - assertThrows(IllegalArgumentException.class, () -> codec.decode(input)); - assertThrows(IllegalArgumentException.class, () -> codec.decode(input.getBytes(StandardCharsets.US_ASCII))); - } - } - /** * Tests that spaces (ASCII 32) ARE in the Base45 alphabet and are NOT skipped during decoding. Space has alphabet value 36. */
