On Tue, 31 Mar 2026 14:07:41 GMT, Daniel Fuchs <[email protected]> wrote:

>> test/jdk/java/net/DatagramSocket/ConnectPortZero.java line 78:
>> 
>>> 76:     @MethodSource("testCases")
>>> 77:     public void testConnect(DatagramSocket ds, InetAddress addr) {
>>> 78:         assertFalse(ds.isConnected());
>> 
>> I see more than a TestNG-to-JUnit migration. I'd be reluctant on 
>> piggybacking such changes along with already loaded TestNG-to-JUnit 
>> migration changes. That said, I trust your judgement on the matter. I'm 
>> assuming you've considered this and decided to keep these improvements.
>> 
>> [Note that this comment applies to more places.]
>
> I had surprising results when running converted tests the first time around 
> because of JUnit autoclosing arguments of type Closeable. So I want to make 
> sure that whatever argument is passed here is not something that has already 
> been closed or connected by another test. Let's call it sanity. It doesn't 
> change what the test is testing, just makes sure that assumptions about 
> invariants are accurate.

I think there is a parameter to the ParameterizedTest annotation which disables 
auto-close if you think that makes thinks simpler (autoCloseArguments).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30502#discussion_r3021086527

Reply via email to