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). ------------- Commit messages: - JDK-8396156 Changes: https://git.openjdk.org/jdk/pull/33643/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=33643&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8396156 Stats: 74 lines in 2 files changed: 49 ins; 4 del; 21 mod Patch: https://git.openjdk.org/jdk/pull/33643.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/33643/head:pull/33643 PR: https://git.openjdk.org/jdk/pull/33643
