georgberky/dependency-update-maven-plugin

Split up Maven plugin into testable parts

helpermethod opened this issue ยท 9 comments

Because testing the plugin as a whole is a non-trivial task, it's probably best to start splitting the plugin into multiple, testable parts.

Each part/class/module should receive their direct dependencies via constructor, so that dependencies can be mocked.

Some ideas:

  • the JGitProvider is almost testable except for the authenticating part - maybe that one could be split out into its own class
  • everything related to updates looks like it would be a candidate for its own class
  • in UpdateMojo.execute() we could wire up all dependencies by either manual DI or some something like koin

@sparsick @georgberky What do you think?

first both ideas match my ideas. I disagree with the third idea (DI) because Maven already uses a DI Framework called Plexus. I would prefer to stay on this path and use Plexus as DI framework and not to try introducing a new DI Framework.

Plexus is no longer the preferred approach for DI in Maven plugins, Sisu is https://wiki.eclipse.org/Sisu/PlexusMigration

Yes you are right .. sorry I mismatch the names. My main point is to use the DI framework that Maven already uses :)

@georgberky and I try to write an own class for the update stuff today. We will send a proposal :)

Hi @sparsick, @georgberky your code looks pretty good from a quick glance! If you want, you can continue extracting the update mechanic and I'll focus on something else.

That would be a pleasure. As next step, we want to introduce unit tests for the single VersionUpdate classes. Maybe we will find a better name for them.