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 559d8c2c33c45e17232d03da6c75353518040aa2 Author: Gary Gregory <[email protected]> AuthorDate: Sun Sep 20 17:57:44 2026 -0400 Sort members. --- .../commons/codec/digest/GitIdentifiersTest.java | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/test/java/org/apache/commons/codec/digest/GitIdentifiersTest.java b/src/test/java/org/apache/commons/codec/digest/GitIdentifiersTest.java index d63a2e25..0f5ba67b 100644 --- a/src/test/java/org/apache/commons/codec/digest/GitIdentifiersTest.java +++ b/src/test/java/org/apache/commons/codec/digest/GitIdentifiersTest.java @@ -164,14 +164,6 @@ class GitIdentifiersTest { assertArrayEquals(Hex.decodeHex(expectedSha1Hex), GitIdentifiers.blobId(DigestUtils.getSha1Digest(), data)); } - @ParameterizedTest - @MethodSource("blobIdProvider") - void testBlobIdInputStreamWithSize(final String resourceName, final String expectedSha1Hex) throws Exception { - final byte[] data = Files.readAllBytes(resourcePath(resourceName)); - assertArrayEquals(Hex.decodeHex(expectedSha1Hex), - GitIdentifiers.blobId(DigestUtils.getSha1Digest(), data.length, new ByteArrayInputStream(data))); - } - @ParameterizedTest @ValueSource(ints = { 0, 1, 8191, 8192, 8193, 20000 }) void testBlobIdInputStreamLengths(final int length) throws IOException { @@ -185,14 +177,11 @@ class GitIdentifiersTest { } @ParameterizedTest - @ValueSource(longs = { -1, 0, 5, 7 }) - void testTreeIdBuilderRejectsWrongStreamSize(final long declaredSize) throws IOException { - final GitIdentifiers.TreeIdBuilder builder = GitIdentifiers.treeIdBuilder(DigestUtils.getSha1Digest()); - builder.addFile(GitIdentifiers.FileMode.REGULAR, "hello.txt", HELLO_CONTENT); - final byte[] expected = builder.get(); - assertThrows(IOException.class, - () -> builder.addFile(GitIdentifiers.FileMode.REGULAR, "hello.txt", declaredSize, new ByteArrayInputStream(HELLO_CONTENT))); - assertArrayEquals(expected, builder.get()); + @MethodSource("blobIdProvider") + void testBlobIdInputStreamWithSize(final String resourceName, final String expectedSha1Hex) throws Exception { + final byte[] data = Files.readAllBytes(resourcePath(resourceName)); + assertArrayEquals(Hex.decodeHex(expectedSha1Hex), + GitIdentifiers.blobId(DigestUtils.getSha1Digest(), data.length, new ByteArrayInputStream(data))); } @ParameterizedTest @@ -389,6 +378,17 @@ class GitIdentifiersTest { assertArrayEquals(expected, viaDirectory.get()); } + @ParameterizedTest + @ValueSource(longs = { -1, 0, 5, 7 }) + void testTreeIdBuilderRejectsWrongStreamSize(final long declaredSize) throws IOException { + final GitIdentifiers.TreeIdBuilder builder = GitIdentifiers.treeIdBuilder(DigestUtils.getSha1Digest()); + builder.addFile(GitIdentifiers.FileMode.REGULAR, "hello.txt", HELLO_CONTENT); + final byte[] expected = builder.get(); + assertThrows(IOException.class, + () -> builder.addFile(GitIdentifiers.FileMode.REGULAR, "hello.txt", declaredSize, new ByteArrayInputStream(HELLO_CONTENT))); + assertArrayEquals(expected, builder.get()); + } + @Test void testTreeIdPath() throws Exception { assertArrayEquals(Hex.decodeHex("e4b21f6d78ceba6eb7c211ac15e3337ec4614e8a"),
