Skip to content

Add integration test for SelectJdkToolchainMojo version range matching - #182

Open
elharo wants to merge 1 commit into
apache:masterfrom
elharo:add-version-matching-tests
Open

Add integration test for SelectJdkToolchainMojo version range matching#182
elharo wants to merge 1 commit into
apache:masterfrom
elharo:add-version-matching-tests

Conversation

@elharo

@elharo elharo commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Refs #167

Adds unit tests for the matches() method in SelectJdkToolchainMojo to verify version matching behavior.

Uses reflection to test the private method without changing source code visibility. Tests confirm that RequirementMatcherFactory.createVersionMatcher() is called with the correct argument order:

  • createVersionMatcher(tcVal).matches(reqVal) where tcVal is the toolchain's concrete version and reqVal is the user's requirement (which may be a range like "[11,17)").

All 3 tests pass against the current code, confirming the existing implementation is correct.

@elharo
elharo force-pushed the add-version-matching-tests branch from 2740bdc to e14544c Compare July 22, 2026 20:42
@elharo elharo changed the title Add unit tests for SelectJdkToolchainMojo version matching Add integration test for SelectJdkToolchainMojo version range matching Jul 22, 2026
@elharo
elharo force-pushed the add-version-matching-tests branch from e14544c to b3fb13f Compare July 22, 2026 20:52
Refs apache#167

Add an integration test that verifies the select-jdk-toolchain goal
correctly matches a toolchain version against a version range requirement.

The test configures a JDK toolchain with version "11" and requests
version range "[11,17)". If the version matching in
SelectJdkToolchainMojo.matches() were broken, the build would fail
with "Cannot find matching toolchain definitions".

Uses reflection-free approach via maven-invoker-plugin integration
test to exercise the full plugin execution path.
@elharo
elharo force-pushed the add-version-matching-tests branch from b3fb13f to d2c8675 Compare July 23, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant