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

Run AssertJ best practices OpenRewrite recipe #456

Merged
merged 1 commit into from
Oct 21, 2022
Merged

Run AssertJ best practices OpenRewrite recipe #456

merged 1 commit into from
Oct 21, 2022

Conversation

timtebeek
Copy link
Contributor

Consistently use static imports for AssertJ, as a once of code change, through OpenRewrite.

mvn org.openrewrite.maven:rewrite-maven-plugin:4.36.0:run \
  -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:1.30.0 \
  -DactiveRecipes=org.openrewrite.java.testing.assertj.Assertj

https://docs.openrewrite.org/reference/recipes/java/testing/assertj/assertj

mvn org.openrewrite.maven:rewrite-maven-plugin:4.36.0:run \
  -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:1.30.0
\
  -DactiveRecipes=org.openrewrite.java.testing.assertj.Assertj
@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2022

Codecov Report

Merging #456 (956e730) into main (f04ee06) will decrease coverage by 0.04%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##               main     #456      +/-   ##
============================================
- Coverage     93.00%   92.95%   -0.05%     
+ Complexity     2096     2094       -2     
============================================
  Files           233      233              
  Lines          4374     4374              
  Branches        449      449              
============================================
- Hits           4068     4066       -2     
- Misses          190      191       +1     
- Partials        116      117       +1     
Impacted Files Coverage Δ
...ker/idnumbers/pt/br/IdNumberGeneratorPtBrUtil.java 92.59% <0.00%> (-3.71%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@bodiam
Copy link
Contributor

bodiam commented Oct 21, 2022

Thanks for this PR, much appreciated!

@bodiam bodiam merged commit 05cdae0 into datafaker-net:main Oct 21, 2022
@timtebeek timtebeek deleted the assertj_best_practises branch October 21, 2022 09:04
@timtebeek
Copy link
Contributor Author

You're welcome; let me know if there's any other types of automated improvements you'd want me to take a look at.
Don't want to overwhelm you with review work if that's not the type of contribution you're looking for right now.

@bodiam
Copy link
Contributor

bodiam commented Oct 21, 2022

@timtebeeko thanks! There might be a thing, but it could be a tricky one : some of our assertions are pretty useless. They basically test that methods are returning something, and that's about it. Something slightly stricter might be nice. That might be hard to do with static code analysis, but open to suggestions!

@timtebeek
Copy link
Contributor Author

Hmm yes closest thing I could find in OpenRewrite on that so far is TestsShouldIncludeAssertions, with some test examples in TestsShouldIncludeAssertionsTest. Not an exact match to what you're looking for, but open to suggestions on how to improve that one or write a new one.

An alternative in that space might be DiffBlue Cover. Fairly new (and pricey), but they have a free trial and might be able to help out for OSS projects. Ideally you'd pinpoint exact area's for improvement through mutation testing and see from there.

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.

3 participants