Skip to content

Conversation

strangelookingnerd
Copy link
Contributor

This PR aims to migrate all tests to JUnit5. Changes include:

  • Migrate annotations and imports
  • Migrate assertions
  • Remove public visibility for test classes and methods
  • Minor clean up

I am well aware that this is a quite large changeset however I hope that there is still interest in this PR and it will be reviewed.
If there are any questions, please do not hesitate to ping me.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

* Migrate annotations and imports
* Migrate assertions
* Remove public visibility for test classes and methods
* Minor code cleanup
# Conflicts:
#	src/test/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketSCMSourceTest.java
#	src/test/java/com/cloudbees/jenkins/plugins/bitbucket/endpoints/BitbucketEndpointConfigurationTest.java
#	src/test/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/WebhookConfigurationTest.java
#	src/test/java/com/cloudbees/jenkins/plugins/bitbucket/impl/client/ExponentialBackOffRetryStrategyTest.java
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the goal is update test cases to JUnit5 than change only JUnit4 test case avoid the refactoring of code formatting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the cleanup included is indeed not directly related to the testing framework but more my personal motivation of following the Boy Scout Rule.

Fixing issues reported by the IDE like avoiding redundant casts, using language features of the current java version, ... are usually low hanging fruits and meant to improve the overall code quality.

Some formatting changes are results of the tools used when creating the PR (mainly OpenRewrite recipes and IntelliJ suggestions). It happens on occasions that I miss or coincidentally even fix formatting issues before submitting the PR. Since this project has no strict enforcement of code styles I can gladly restore formatting if you find some of them out of place or wrong.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use eclipse with sonarqube, I do not see any redundant casts, for other things there is a specific reason or personal reason that make me life easier when I'm in debug.
The project has a basic checkstyle also to avoid me and other people get crazy, normally PR does not reformat code and normally in case I ask to revert.
Unless strictly required update only JUnit4 classeses to avoid review every single changes, also because I want migrate all assertions to assertj or json assert.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. I have been using SonarLint as well and most suggestions are made there, too. Feel free to mark any optimizations you want me to revert.
Regarding enforcement of formatting rules I can highly suggest to think about enabling spotless via https://github.com/jenkinsci/plugin-pom This way you can rely on clean formatting for every PR. I found it very useful compared to checkstyle which in my opinion oftentimes makes life harder.

# Conflicts:
#	src/test/java/com/cloudbees/jenkins/plugins/bitbucket/impl/notifier/BitbucketBuildStatusNotificationsTest.java
#	src/test/java/com/cloudbees/jenkins/plugins/bitbucket/trait/BranchDiscoveryTraitTest.java
#	src/test/java/com/cloudbees/jenkins/plugins/bitbucket/trait/SSHCheckoutTraitTest.java
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.

2 participants