Skip to content

Migrate ScpWagonWithProxyTest off PlexusTestCase - #931

Merged
slachiewicz merged 1 commit into
masterfrom
junit5-scp-proxy-test
Aug 18, 2026
Merged

Migrate ScpWagonWithProxyTest off PlexusTestCase#931
slachiewicz merged 1 commit into
masterfrom
junit5-scp-proxy-test

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

The last PlexusTestCase in wagon-ssh.

Unlike the other providers migrated so far, this one genuinely needs a container.
AbstractJschWagon declares knownHostsProvider (@Named("file")), interactiveUserInfo and
uIKeyboardInteractive with @Inject; constructing the wagon directly would leave all three null and
the test would keep passing while exercising something different. So it moves to plexus-testing with
@Inject @Named("scp"), and implements PlexusTestConfiguration to carry over the SCANNING_INDEX
setting the sisu-annotated providers need.

wagon-ssh also gains junit-vintage-engine: ScpWagonTest, SftpWagonTest,
EmbeddedScpWagonWithKeyTest, SshCommandExecutorTest and ScpWagonWithSshPrivateKeySearchTest still
inherit their test methods from the published WagonTestCase, and surefire provisions the jupiter
engine but not the vintage one.

Verification, including its limit

This module excludes every one of its test classes from surefire — **/ScpWagon*Test.* covers this
one — so mvn test in wagon-ssh runs nothing and reports success either way. Passing -Dtest
overrides the exclusion, which makes a real comparison possible:

cases errors failures
before 2 0 2
after 2 0 2

Identical. Both fail on assertTrue(handled) because the proxy is never reached without an ssh server
present, which is what the exclusions exist for.

That identity is also the evidence that the injection works: had @Inject @Named("scp") not resolved,
the run would have produced NPE errors, not the same two assertion failures — the test only
reaches that assertion after wagon.connect(...) has thrown AuthenticationException.

This change was created with AI assistance.

This one needs a real container, unlike the other providers: AbstractJschWagon
declares knownHostsProvider, interactiveUserInfo and uIKeyboardInteractive with
@Inject, so constructing the wagon directly would leave them null and the test
would keep passing while exercising something else. Hence plexus-testing and
@Inject @nAmed("scp"), with PlexusTestConfiguration carrying over the
SCANNING_INDEX setting the sisu-annotated providers need.

wagon-ssh also gains junit-vintage-engine: five tests here still inherit their
methods from the published WagonTestCase, and surefire provisions the jupiter
engine but not the vintage one.
@slachiewicz
slachiewicz marked this pull request as ready for review August 18, 2026 09:31
@slachiewicz
slachiewicz merged commit f289bdd into master Aug 18, 2026
5 checks passed
@slachiewicz
slachiewicz deleted the junit5-scp-proxy-test branch August 18, 2026 10:28
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