Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for PluginModernizer class #736

Closed

Conversation

biru-codeastromer
Copy link

Fixes #731

Add unit tests for the PluginModernizer class.

  • Add PluginModernizerTest class in plugin-modernizer-core/src/test/java/io/jenkins/tools/pluginmodernizer/core/impl/PluginModernizerTest.java.
  • Mock dependencies: Config, MavenInvoker, GHService, PluginService, CacheManager.
  • Test validate method to ensure it calls mavenInvoker.validateMaven, mavenInvoker.validateMavenVersion, and ghService.connect.
  • Test listRecipes method to ensure it logs available recipes.
  • Test isDryRun, getGithubOwner, getSshPrivateKeyPath, getMavenVersion, getMavenHome, getMavenLocalRepo, getCachePath, getJavaVersion methods to ensure they return correct values.
  • Test cleanCache, start, process, collectMetadata, compilePlugin, verifyPlugin, printResults, printModifiedFiles methods to ensure they perform expected actions.

Fixes jenkins-infra#731

Add unit tests for the `PluginModernizer` class.

* Add `PluginModernizerTest` class in `plugin-modernizer-core/src/test/java/io/jenkins/tools/pluginmodernizer/core/impl/PluginModernizerTest.java`.
* Mock dependencies: `Config`, `MavenInvoker`, `GHService`, `PluginService`, `CacheManager`.
* Test `validate` method to ensure it calls `mavenInvoker.validateMaven`, `mavenInvoker.validateMavenVersion`, and `ghService.connect`.
* Test `listRecipes` method to ensure it logs available recipes.
* Test `isDryRun`, `getGithubOwner`, `getSshPrivateKeyPath`, `getMavenVersion`, `getMavenHome`, `getMavenLocalRepo`, `getCachePath`, `getJavaVersion` methods to ensure they return correct values.
* Test `cleanCache`, `start`, `process`, `collectMetadata`, `compilePlugin`, `verifyPlugin`, `printResults`, `printModifiedFiles` methods to ensure they perform expected actions.
@jonesbusy
Copy link
Collaborator

Test doesn't compile due to private access. Please reopen when ready

@jonesbusy jonesbusy closed this Jan 27, 2025
@biru-codeastromer biru-codeastromer deleted the add-unit-tests branch January 27, 2025 20:40
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.

Unit tests for PluginModernizer class
2 participants