Repository navigation
Move the mojo tests that take their project from a POM to JUnit 5 - #1425
Merged
Merged
Conversation
This was referenced Oct 10, 2026
slachiewicz
marked this pull request as ready for review
October 10, 2026 19:09
… to JUnit 5 ProjectMojos looks up mojos from code, on the project built from a given POM or reactor, configured like a build would: inherited plugin configuration, default settings, the session's projects. Part of #1414.
slachiewicz
force-pushed
the
agent/junit5-pom-updaters
branch
from
October 10, 2026 19:25
f8eb5e4 to
2d263a1
Compare
…a POM to JUnit 5 ProjectMojoExtension also gives mojos a plugin context and the session a repository session, as the JUnit 4 harness did. testDependenciesMatchTestScope ran only because JUnit 3 picked up every test* method; it is now annotated. Part of #1414.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1414, step 2. The fourteen classes that took their project from a test POM through
AbstractMojoTestCaseandMojoRulemove toProjectMojoExtensionfrom #1423 and off Hamcrest:SetMojoTest,UseDepVersionMojoTest,SetPropertyMojoTest,UpdatePropertiesMojoTestwith its base,UpdatePropertyMojoTest,SetScmTagMojoTest,RevertMojoTest,UpdateChildModulesMojoTest;DisplayDependencyUpdatesMojoTest,DisplayPropertyUpdatesMojoTest,DisplayPluginUpdatesMojoTest,PropertyUpdatesReportTest,CompareDependenciesMojoTest,SkipParameterTest.These tests pick their POM at run time, copy it themselves and read it back, so the extension gets a lookup from code next to
@InjectMojo:ProjectMojos.lookup(goal, pom)andlookupInReactor(goal, baseDir, modules...), taken as a test or@BeforeEachparameter; neither copies the POM. The extension now also does what the JUnit 4 harness did andMojoExtensiondoes not, for both kinds of lookup:UseDepVersionMojoTest.testPropertyFromParenttakesdepVersionfrom the parent);Settingsand aDefaultRepositorySystemSessioninstead ofnull;null.testDependenciesMatchTestScopehad no@Testand ran only because JUnit 3 picks up every publictest*method; it is now annotated.TestUtils.createMavenSession, the last caller of the deprecatedMavenSessionconstructor,TestUtils.fixAllProjectsand the Hamcrest matcher inTestIgnoreVersionsgo with their last callers.TextAssertionsgetsassertTextNotMatchesandassertNoLineContains.Verified:
mvn clean install -Dinvoker.skip→ all modules pass, 297 tests in the plugin, the same count as before for each of the fourteen classes, 0 Checkstyle violations