Skip to content

Commit

Permalink
Merge pull request #955 from hazendaz/java.io.fixes
Browse files Browse the repository at this point in the history
Simplify our hashing verification check in tests
  • Loading branch information
hazendaz authored Jan 20, 2025
2 parents 07cbdff + d7a4397 commit a9adacd
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,8 @@ private void doTestFormat(final Map<String, String> options, final Formatter for
}

// We are hashing this as set in stone in case for some reason our source file changes unexpectedly.
final var sha512 = Hashing.sha512().hashBytes(Files.readAllBytes(sourceFile)).asBytes();
final var sb = new StringBuilder();
for (final byte element : sha512) {
sb.append(Integer.toString((element & 0xff) + 0x100, 16).substring(1));
}

Assertions.assertEquals(expectedSha512, sb.toString());
final var sha512 = Hashing.sha512().hashBytes(Files.readAllBytes(sourceFile)).toString();
Assertions.assertEquals(expectedSha512, sha512);
}

}

0 comments on commit a9adacd

Please sign in to comment.