RFR: 8301701 : java/net/DatagramSocket/DatagramSocketMulticasting.java should be hardened [v4]

Daniel Jeliński djelinski at openjdk.org
Tue Feb 21 13:53:29 UTC 2023


On Tue, 21 Feb 2023 12:51:54 GMT, Darragh Clarke <duke at openjdk.org> wrote:

>> Updated `DatagramSocketMulticasting` to use Junit and also hardened the test to avoid occasional interference from other tests.
>> 
>> - Test now uses Junit Assertions, in general if the assertion used had been `assertTrue(foo==bar)` I replaced it with `assertEquals(foo,bar)` though there are some cases where I used `assertTrue` or `assertFalse`
>> - `testSendReceive` now retries up to 3 times if a message from an unexpected port is received
>> - Both `testSendReceive` and `testSendNoReceive` both have messages that use the methods name instead of just "hello"
>> 
>> Ran tiers 1-3 of tests as well as running this updated test to make sure it was stable
>
> Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision:
> 
>   reformatted long lines

test/jdk/java/net/DatagramSocket/DatagramSocketMulticasting.java line 260:

> 258:     static void testTimeToLive(DatagramSocket s) throws IOException {
> 259:         // should be 1 by default
> 260:         assertEquals(s.getOption(IP_MULTICAST_TTL), 1);

Please put the expected value as the first argument to `assertEquals`, otherwise the exception messages may be a bit misleading

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

PR: https://git.openjdk.org/jdk/pull/12513


More information about the net-dev mailing list