RFR: 8378163: test/jdk/java/net/httpclient/*.java: convert tests that use ITestContext to JUnit

Alan Bateman alanb at openjdk.org
Wed Feb 18 14:13:57 UTC 2026


On Wed, 18 Feb 2026 12:20:49 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

> This is a first step that converts all tests directly located in the test/jdk/java/net/httpclient directory and which depend on ITestContext (a TestNG API) to use JUnit instead. 
> 
> Usage of ITestContext is replaced by registering a TestWatcher which can make JUnit stop at the first failure.
> The proposed change is mostly mechanical - with the exception of SpecialHeadersTest which is now also testing HTTP/3.
> Some logging in a few of the tests has also been improved.
> 
> This is a test change only.

test/jdk/java/net/httpclient/ForbiddenHeadTest.java line 88:

> 86: import org.junit.jupiter.params.provider.MethodSource;
> 87: 
> 88: @TestInstance(TestInstance.Lifecycle.PER_CLASS)

I see this is added to a lot of tests. Have you dug into why this is needed? Just wondering if there are method sources (for parameterize tests) that are instance rather than static methods or what is the reason.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29786#discussion_r2822559103


More information about the net-dev mailing list