-
Notifications
You must be signed in to change notification settings - Fork 77
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 refaster recipes to simplify expected value #475
Conversation
copied from rewrite-recipe-starter
328ac47
to
2fdafa0
Compare
src/test/java/org/openrewrite/java/testing/assertj/SimplifyAssertExpectationsTest.java
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/testing/assertj/SimplifyAssertExpectationsTest.java
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/testing/assertj/SimplifyAssertExpectationsTest.java
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/testing/assertj/SimplifyAssertExpectationsTest.java
Show resolved
Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
public class SimplifyToIsZero { | ||
|
||
@BeforeTemplate | ||
void before(Integer i) { |
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 think you want to use primitive types in the method signatures.
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 tried it for both "Integer" recipes, but still get "Recipe was expected to make a change but made no changes." for all three tests.
src/test/java/org/openrewrite/java/testing/assertj/SimplifyAssertExpectationsTest.java
Outdated
Show resolved
Hide resolved
…ertExpectationsTest.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Had another quick look after applying some small changes, but the Any insights there @knutwannheden ? Seems like a good use case to do this type of simplification with Refaster recipes. |
Hi @timo-abele ; I've started two new efforts to (better) leverage the work done by our friends at Picnic:
I believe that could replace the recipes you've added here, given that theirs are already similar:
Would you agree with closing this effort and instead replying on the upstream EPS project for these improvements? |
Closing this effort for now, as we need an upstream fix in rewrite-templating first, and in parallel we also have this PR that might cover some of the same Note that the work here is much appreciated though! It's just the generics that are tripping us up to merge this as-is without additional effort put into openrewrite/rewrite-templating#91 first. Hope to revisit as soon as support is there though, and linking this issue into that one to be notified. |
Upstream we've seen a fix introduced That means we now should see results from the existing ErrorProne Support recipes we pull in rewrite-testing-frameworks/src/main/resources/META-INF/rewrite/assertj.yml Lines 31 to 45 in 3412efb
That reduces the need to reimplement them here. Thanks again for uncovering that we had an issue which is now solved! |
What's changed?
3 simple refaster recipes added
What's your motivation?
salvaging the changes in #472
adding missing transformations I noticed.
Anything in particular you'd like reviewers to focus on?
These recipes are simpler that the ones in #472: they don't need generics and should work in Java 8. But each test yields:
Anyone you would like to review specifically?
@timtebeek
Have you considered any alternatives or workarounds?
SimplifyChainedAssertJAssertion could probably be extended to cover these cases, but I think refaster is the appropriate level of complexity
Any additional context
Checklist