Skip to content

Migrate HttpWagonHttpServerTestCase and its subclasses off PlexusTestCase - #930

Merged
slachiewicz merged 1 commit into
masterfrom
junit5-http-server-testcase
Aug 18, 2026
Merged

Migrate HttpWagonHttpServerTestCase and its subclasses off PlexusTestCase#930
slachiewicz merged 1 commit into
masterfrom
junit5-http-server-testcase

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Completes the wagon-http side of moving off PlexusTestCase: the abstract
HttpWagonHttpServerTestCase and its two subclasses.

No new dependency is needed. The container was only supplying Wagon.ROLE, which is HttpWagon, and
AbstractHttpClientWagon declares no injected collaborators, so new HttpWagon() is equivalent to the
lookup — the same reasoning already applied to HugeFileDownloadTest.

Two details that are not mechanical and are worth a look:

  • The base lifecycle method is renamed startTestServer. Left as setUp(), the subclasses' own
    setUp() would override it, and JUnit 5 would then run only the override — the Jetty server would
    never be created and every test would fail on a null. With distinct names JUnit 5 runs the
    superclass @BeforeEach first in its own right, so the subclasses drop their super.setUp() call.
  • getName() came from junit.framework.TestCase and is used to build unique temp file names
    (FileTestUtils.createUniqueFile(getName(), getName()), six call sites). It now comes from an
    injected TestInfo, so those call sites are unchanged.

Verified: mvn test on wagon-http, counting <testcase> elements per class — 295 before and after,
2 skipped in both, zero failures. HttpWagonErrorTest stays at 5 and HttpWagonTimeoutTest at 4,
which is what shows the base setup still runs; had it not, both would have failed on a null server
rather than silently reporting fewer tests.

This change was created with AI assistance.

…Case

The container was only supplying Wagon.ROLE, which is HttpWagon, and
AbstractHttpClientWagon declares no injected collaborators, so a plain
constructor is equivalent.

The base lifecycle method is renamed startTestServer so a subclass
@beforeeach cannot override it: with the same signature JUnit 5 would run
only the override and the server would never be created. The subclasses
therefore drop their super.setUp() call, since JUnit 5 runs a superclass
@beforeeach first on its own.

getName() came from junit.framework.TestCase and is used to build unique
temp file names; it now comes from an injected TestInfo, leaving the six
call sites unchanged.
@slachiewicz
slachiewicz marked this pull request as ready for review August 18, 2026 09:29
@slachiewicz
slachiewicz merged commit a206db0 into master Aug 18, 2026
5 of 6 checks passed
@slachiewicz
slachiewicz deleted the junit5-http-server-testcase branch August 18, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant