Repository navigation
Description
The plugin has 251 integration tests, and each one is a separate Maven run of a few seconds. Many of them test a combination of parameters on a single POM, which a unit test covers as well, in a fraction of the time and with a readable failure. This issue tracks moving those to unit tests and unifying how both kinds of test are written.
What the ITs do
| Group | ITs | Plan |
|---|---|---|
One goal on one POM, checks the rewritten pom.xml |
135 | split below |
display-* goals, check the log or the output file |
43 | split below |
| Several Maven runs in one IT | 19 | keep |
| Multi-module projects | 30 | keep |
| Site and reports | 18 | keep |
Settings, offline mode, .mvn |
6 | keep |
Of the 178 single-run ITs, 67 depend only on the available versions and the goal's parameters. Those can move to parameterized unit tests built on MockUtils and TestChangeRecorder, which the existing mojo tests already use:
update-properties(16): theallowMajorUpdates,allowMinorUpdatesandallowIncrementalUpdatescombinations, includes, excludes and single-version ranges.UpdatePropertiesMojoTesthas 6 tests and none for includes or excludes.display-dependency-updates(16): theissue-318filters and theissue-34process*flags, much of whichDisplayDependencyUpdatesMojoTestalready covers.display-plugin-updates(8),use-latest-*anduse-next-*(16),compare-dependencies(5), and a fewsetandupdate-propertyITs.
The other 110 stay, because they exercise what a mocked repository does not: snapshot metadata (55), parent inheritance (28), rules files, encoding and outputTimestamp (22), ranges (20), BOM imports (14), the change recorder output (7) and profiles (3). The counts overlap. One IT per goal stays as well, so every goal still runs end to end.
An IT is deleted only in the PR that adds a unit test with the same inputs and the same expected result.
Unifying the tests
- Verify scripts: 121 use
try,System.err.printlnandreturn false, 117 useassert. Theassertform says what failed; the other one prints a message and leaves the invoker to report a generic failure. - Unit tests: 34 files on JUnit 4, 22 on JUnit 5; mojos built either through the plugin testing harness or as anonymous subclasses, with 234
setVariableValueToObjectcalls that bypass parameter binding; no parameterized tests at all.
Found on the way
it-use-latest-versions-issue-134ranuse-latest-releases, so issue Goal: use-releases doesn't processes imported POMs in dependencyManagement #134 was never checked foruse-latest-versions.it-property-updates-report-issue-684-001was a byte-for-byte copy ofit-plugin-updates-report-issue-684-001, runningplugin-updates-report. Option to ignore plugin versions in pom.xml without need for Rules.xml #684 is about plugins only.DisplayPluginUpdatesMojopasses two maps that are always empty (parentBuildPlugins,parentReportPlugins); Share plugin discovery and version lookup between display and reports #1397 removes them.AbstractVersionsUpdaterMojo.shouldApplyUpdate(Artifact, String, ArtifactVersion)is deprecated and has no callers. It isprotected, so its removal waits for the next major version.
Pull requests
- Fix two ITs that tested a different goal than their name #1415 Fix two ITs that tested a different goal than their name
- Move twelve update-properties ITs to unit tests #1416 Move twelve update-properties ITs to unit tests
- Move sixteen display-dependency-updates ITs to unit tests #1417 Move sixteen display-dependency-updates ITs to unit tests
- Move fifteen use-* ITs to unit tests #1418 Move fifteen use-* ITs to unit tests
- Not moved after a closer look:
display-plugin-updatesreads plugin POMs and their Maven requirements from the repository,compare-dependenciesbuilds the remote BOM,it-set-009depends on-f alternative-pom.xml, andit-use-releases-issue-583onallowRangeMatchingagainst real ranges - Write 54 verify scripts as assertions #1421 Write 54 verify scripts as assertions
- Write the remaining verify scripts as assertions #1431 Write the remaining 36 verify scripts as assertions (three of them asserted nothing)
- Stop calling deprecated StringUtils.equals and MavenProject reporting getters #1420 Stop calling deprecated StringUtils.equals and MavenProject reporting getters (CI warnings)
- Move the tests that do not use the plugin testing harness to JUnit 5 and off Hamcrest #1422 Move the tests that do not use the plugin testing harness to JUnit 5 and off Hamcrest
- Run mojo tests on JUnit 5 with the project built from their POM #1423 Run mojo tests on JUnit 5 with the project built from their POM (
ProjectMojoExtension, the three scenario classes) - Move the mojo tests that build their project in code to JUnit 5 #1424 Move the mojo tests that build their project in code to JUnit 5 (nine classes, no harness needed)
- Move the mojo tests that take their project from a POM to JUnit 5 #1425 Move the mojo tests that take their project from a POM to JUnit 5 (fourteen classes; includes Move the display, report and skip tests that take their project from a POM to JUnit 5 #1426)
- Move the display, report and skip tests that take their project from a POM to JUnit 5 #1426 merged into Move the mojo tests that take their project from a POM to JUnit 5 #1425
- Drop JUnit 4, the vintage engine and Hamcrest from the plugin tests #1427 Drop JUnit 4, the vintage engine and Hamcrest from the plugin tests (stacked on Move the mojo tests that take their project from a POM to JUnit 5 #1425)
- Move the tests of versions-common and versions-enforcer off Hamcrest #1430 Move the tests of versions-common and versions-enforcer off Hamcrest (they were already on JUnit 5)
- Build against Maven 3.9.16 and keep Maven 3.6.3 as the prerequisite #1429 Build against Maven 3.9.16 and resolver 1.9.27, keeping the 3.6.3 prerequisite (CI warnings, Dependabot alerts)
Activity
Fix two ITs that tested a different goal than their name
Move twelve update-properties ITs to unit tests
Move sixteen display-dependency-updates ITs to unit tests
Move fifteen use-* ITs to unit tests
Write 54 verify scripts as assertions
Run mojo tests on JUnit 5 with the project built from their POM
Run mojo tests on JUnit 5 with the project built from their POM
Move the mojo tests that take their project from a POM and rewrite it…
Move the display, report and skip tests that take their project from …
Move the display, report and skip tests that take their project from …
Move the mojo tests that take their project from a POM and rewrite it…
Move the display, report and skip tests that take their project from …
slachiewicz commentedon Oct 11, 2026
Done: every item is merged, the last one in #1431. The plugin, versions-common and versions-enforcer tests are on JUnit 5 without Hamcrest, and every verify script is written as assertions.
Move update-properties, update-property and use-* ITs to unit tests
Move set, set-property, outputTimestamp, encoding and skip ITs to uni…