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

Daniel Fuchs dfuchs at openjdk.org
Mon Sep 22 14:52:40 UTC 2025


On Mon, 22 Sep 2025 07:55:22 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

>> Refactoring following httpclient/http2 testng test to JUnit :
>> test/jdk/java/net/httpclient/http2/BadHeadersTest.java
>> test/jdk/java/net/httpclient/http2/BadPushPromiseTest.java
>> test/jdk/java/net/httpclient/http2/BasicTest.java
>> test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java
>> test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java
>
> 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.

> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27388#discussion_r2368693907
PR Review Comment: https://git.openjdk.org/jdk/pull/27388#discussion_r2368703123


More information about the net-dev mailing list