mojohaus / versions

Versions Maven Plugin
https://www.mojohaus.org/versions/versions-maven-plugin/
Apache License 2.0
328 stars 265 forks source link

Align update-parent and display-parent-update #1017

Closed cachescrubber closed 7 months ago

cachescrubber commented 8 months ago

Resolves #1016

cachescrubber commented 8 months ago

Of course it does not feel good to introduce duplicated code en mass, but we need to start somewhere.

cachescrubber commented 8 months ago

I added another Test, DisplayParentUpdatesMojoOutputTest which is based on AbstractMojoTestCase like all other Display*Tests. As soon as I add a parent to my test-cases pom, test execution will fail with

java.lang.IllegalArgumentException: Invalid repository system session: LocalRepositoryManager is not set.

jarmoniuk commented 8 months ago

This is coming from DefaultRepositorySystem::validateSession, which is usually called -- too bad you didn't provide a stack trace ;) -- from RepositorySystem::resolveVersion.

You either need to mock the call so that it returns what you want (see e.g. MockUtils) or just use the regular integration tests (the "it" directory).

Good luck!

jarmoniuk commented 8 months ago

Hi @cachescrubber, do you need any more assistance with the failing tests?

cachescrubber commented 7 months ago

@ajarmoniuk I gave up on the *Output test. Instead, I aligned DisplayParentUpdatesMojoOutputTest (new) with UpdateParentMojoTest. Could you please review my changes?

jarmoniuk commented 7 months ago

@slawekjaranowski please approve the workflow and/or raise additional PR commments.