RFR: 8345176: Add tests to verify java.net.Socket constructors close the socket on failure [v3]
    Volkan Yazıcı 
    duke at openjdk.org
       
    Fri Nov 29 15:04:20 UTC 2024
    
    
  
On Fri, 29 Nov 2024 14:19:09 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> Volkan Yazıcı has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add `MockSocketImpl#toString()` to aid test output visuals
>
> test/jdk/java/net/Socket/CtorFailTest.java line 166:
> 
>> 164:             }
>> 165:             valueByKey.put("closeInvocationCounter", closeInvocationCounter.get());
>> 166:             return MockSocketImpl.class.getSimpleName() + valueByKey;
> 
> Have you considered using record instead of Map? You can create a local record class within a method...
> 
> 
>         record MockSocket(Exception bindException, Exception connectException) { }
>         return new MockSocket(bindException, connectException).toString();
> 
> 
> (or you could name the record "TestCase" or whatever...)
Switched to using records.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22439#discussion_r1863651543
    
    
More information about the net-dev
mailing list