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

Volkan Yazici vyazici at openjdk.org
Fri Feb 20 13:50:50 UTC 2026


On Fri, 20 Feb 2026 11:10:30 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.
>
> Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - Merge branch 'master' into ITestContext-httpclient-8378163
>  - Remove Lifecycle.PER_CLASS
>  - Merge branch 'master' into ITestContext-httpclient-8378163
>  - 8378163: test/jdk/java/net/httpclient/*.java: convert tests that use ITestContext to JUnit

@dfuch, I've skimmed over the changes (it was big!) and could not see any red flags. I'm assuming Tier 1-2 is clear. Thanks so much for taking care of this work.

test/jdk/java/net/httpclient/AggregateRequestBodyTest.java line 159:

> 157:     }
> 158: 
> 159:     static final class TestStopper implements TestWatcher, BeforeEachCallback {

We shouldn't be copy-pasting such a basic(?) JUnit operator. I will check following options in preference order:

1. Does JUnit provide a feature to _"stop after failure"_?
2. If not, could JUnit maintainers add such a feature? (We can also contribute this, granted they approve the design.)
3. If not, add this to `/test/lib`.

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

Marked as reviewed by vyazici (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/29786#pullrequestreview-3831987984
PR Review Comment: https://git.openjdk.org/jdk/pull/29786#discussion_r2833162492


More information about the net-dev mailing list