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

Christian Stein cstein at openjdk.org
Fri Feb 20 15:53:20 UTC 2026


On Fri, 20 Feb 2026 13:59:37 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> 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`.
>
> It's not worse than the previous boiler plate. It's in fact much better. It was suggested by @sormuras .

A custom `TestStopper` (reusable as a library class in `/test/lib`) is the best we can do at the moment, without upgrading `jtreg` to bundle JUnit 6 (providing such a feature at the test engine level - at the cost of Java 17 baseline) and without introducing a new 3rd-party dependency to, for example, JUnit Pioneer with its https://junit-pioneer.org/docs/disable-if-test-fails/ annotation.

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

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


More information about the net-dev mailing list