-
Notifications
You must be signed in to change notification settings - Fork 364
Migrate tests to JUnit5 #1094
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
base: master
Are you sure you want to change the base?
Migrate tests to JUnit5 #1094
Conversation
* 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
src/test/java/com/cloudbees/jenkins/plugins/bitbucket/trait/SSHCheckoutTraitTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/cloudbees/jenkins/plugins/bitbucket/trait/BranchDiscoveryTraitTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
This PR aims to migrate all tests to JUnit5. Changes include:
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