On Fri, 30 Oct 2026 08:14:45 GMT, Tobias Hartmann <[email protected]> wrote:
> When writing a test, I noticed that `assertNull(42)` fails with > `assertEquals expected: 42 but was: null` instead of `assertNull: expected > null but was 42`. So I thought "Let's quickly fix that!". Well, I found and > fixed more issues in the process and also added proper testing. > > Here's an overview: > | | | Before | After | > | --- | --- | --- | --- | > | **1** | `assertNull(42)` | `assertEquals expected: 42 but was: null` | > `assertNull: expected null but was 42` | > | **2** | `assertNotNull(null)` | `assertNotEquals: expected not equals but > was null` | `assertNotNull: expected non-null but was null` | > | **3** | `assertEqualsByteArray(null, new byte[1])` | `NullPointerException` > while formatting the failure | `assertEqualsByteArray: expected null but was > 00` | > | **4** | `assertLessThan(null, 42)` | `null: values must be non-null: <null> > , <42>` | `assertLessThan: values must be non-null: <null> , <42>` | > > I put the explanations in-line with the changes. > > Thanks, > Tobias > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). Thank you for fixing this at your speed, Tobias. I was confused before but, not enough to spur into action. This looks good. ------------- Marked as reviewed by mhaessig (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/33643#pullrequestreview-5710051421
