On Tue, 16 Dec 2025 23:37:59 GMT, Chen Liang <[email protected]> wrote:

>> eunbin son has refreshed the contents of this pull request, and previous 
>> commits have been removed. The incremental views will show differences 
>> compared to the previous content of the PR. The pull request contains one 
>> new commit since the last revision:
>> 
>>   8373661: Convert BasicObjectsTest to JUnit format
>>   
>>      - Converted all 17 test methods from jtreg main-method format to JUnit
>>      - Removed main() method
>>      - Added @run junit annotation
>>      - All tests follow OpenJDK JUnit testing patterns
>>   
>>      Thanks to @RogerRiggs for the feedback.
>
> test/jdk/java/util/Objects/BasicObjectsTest.java line 305:
> 
>> 303:             RuntimeException.class,
>> 304:             () -> Objects.requireNonNull(null, () -> {
>> 305:                 throw new RuntimeException("Supplier exception");
> 
> Instead of detecting by message, you can allocate an exception outside of the 
> lambda, throw it here, and assertSame your exception with the assertThrows 
> returned exception.

@liach Thank you for the feedback! I've updated the test to allocate the 
exception outside of the lambda and use `assertSame` to verify the same 
exception instance is thrown, as you suggested. This provides a more precise 
verification that the exception from the supplier is thrown directly, not 
wrapped. 

The changes have been pushed. Please review again.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28845#discussion_r2626741691

Reply via email to