On Tue, 7 Apr 2026 13:45:08 GMT, Daniel Fuchs <[email protected]> wrote:

>> test/jdk/java/net/Socket/UdpSocket.java line 46:
>> 
>>> 44:             new Socket("doesnotmatter", 12345, false);
>>> 45:             fail("Socket constructor was expected to throw 
>>> IllegalArgumentException" +
>>> 46:                     " for stream=false, but didn't");
>> 
>> `assertThrows`?
>
> I think it's fine as it is. No need to complicate things just for the purpose 
> of using assertThrows.

It would probably make it more concise (assuming the custom `fail` message is 
not relevant):

var e = assertThrows(IllegalArgumentException.class, () -> new 
Socket("doesnotmatter", 12345, false));
assertExceptionMessage(e);


But anyway, this was only a suggestion.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30564#discussion_r3046362696

Reply via email to