RFR: 8373661: Add edge case tests for Objects.requireNonNull methods [v4]
Chen Liang
liach at openjdk.org
Wed Dec 17 22:11:15 UTC 2025
On Wed, 17 Dec 2025 21:03:48 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> eunbin son has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8373661: Use assertSame for exception instance verification
>>
>> Updated testRequireNonNullWithSupplierThrowingException to allocate
>> the exception outside of the lambda and use assertSame to verify
>> the same exception instance is thrown, as suggested by @liach.
>>
>> This provides a more precise verification that the exception from
>> the supplier is thrown directly, not wrapped.
>>
>> Thanks to @liach for the feedback.
>
> test/jdk/java/util/Objects/BasicObjectsTest.java line 218:
>
>> 216: "isNull(null) should return true");
>> 217: assertFalse(Objects.isNull(Objects.class),
>> 218: "isNull(Objects.class) should return false");
>
> Could be simplifed with Assertions.assertNull or assertNonNull. Here and elsewhere in this test.
I think this is testing `isNull` API and shouldn't be simplified.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28845#discussion_r2628817056
More information about the core-libs-dev
mailing list