RFR: 8340493: Fix some Asserts failure messages
Valerie Peng
valeriep at openjdk.org
Mon Dec 16 22:31:38 UTC 2024
On Fri, 20 Sep 2024 00:33:39 GMT, Weijun Wang <weijun at openjdk.org> wrote:
> `Asserts.assertNotEquals` shows "expected 12345 to not equal 12345" which sounds redundant, just say "expected not equals but was 12345".
>
> `Asserts.assertEqualsByteArray` uses the words "expected... to equal...". Modify it to follow the `assertEquals` style ""expected... but was...".
test/lib/jdk/test/lib/Asserts.java line 272:
> 270: msg = Objects.toString(msg, "assertEqualsByteArray")
> 271: + ": expected " + HexFormat.of().formatHex(lhs)
> 272: + " but was " + HexFormat.of().formatHex(rhs);
The original message is about these two bytes being unequal, but with the new message, it seems to imply that the first argument `lhs` is the expected value and `rhs` is the actual value. I grokked a few calls of this method and it seems that this may not always be the case?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21101#discussion_r1887661314
More information about the core-libs-dev
mailing list