RFR: 8318662: Refactor some jdk/java/net/httpclient/http2 tests to JUnit [v2]

Mahendra Chhipa mchhipa at openjdk.org
Tue Sep 23 16:48:15 UTC 2025


On Mon, 22 Sep 2025 14:25:54 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> test/jdk/java/net/httpclient/http2/BadHeadersTest.java line 88:
>> 
>>> 86:     );
>>> 87: 
>>> 88:     SSLContext sslContext;
>> 
>> These can be `private` for better encapsulation.
>
> Agreed - though that doesn't really matter here. We're changing those line anayway to make the fields static - so yes - we can make them private.

Thanks. Now these are private.

>> test/jdk/java/net/httpclient/http2/BadHeadersTest.java line 145:
>> 
>>> 143:                 Arguments.of(http2URI,  true,  byteAtATime),
>>> 144:                 Arguments.of(https2URI, true,  byteAtATime)
>>> 145:         );
>> 
>> AFAICT, you don't need to return a `Stream<Arguments>`, the old `Object[][]` should suffice. Maybe that is better to revert this to old style to keep the diff minimal – granted `Object[][]` indeed works with JUnit.
>
> If this was a new tests then IMO using `Arguments.of(...)` would be preferable. Since this is an old test then arguably keeping the old Object[][] could make backports easier.

Thanks. reverted to Object[][].

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27388#discussion_r2372905788
PR Review Comment: https://git.openjdk.org/jdk/pull/27388#discussion_r2372906936


More information about the net-dev mailing list