-
Notifications
You must be signed in to change notification settings - Fork 72
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
Flatten Hamcrest assertThat allOf #375
Conversation
@AlekSimpson I'd started on this one but it's late and I don't quite know right now how to resolve the test failures; perhaps you've solved this elsewhere already by now? Otherwise we can ask someone else to have a look. |
src/main/java/org/openrewrite/java/testing/hamcrest/FlattenAllOf.java
Outdated
Show resolved
Hide resolved
I don't believe I've seen this error before. I looked at the code and it seems like you are passing null into |
@timtebeek Ok so I thought of a different approach that maybe would be simpler. Basically it uses the |
Thanks for picking this up! Generating multiple statements at once is an approach I had also tried indeed, but got the same issues that you're having. Would need to see if we recall this pattern used elsewhere, but didn't manage to fit that in at the time. 🤔 |
Thanks for the trigger to rethink this! I now remembered that I had done something similar a while ago in cucumber-jvm: The JavaTemplate can only return a |
What's changed?
Convert Hamcrest
allOf(Matcher...)
to individualassertThat
statements for easier migration.What's your motivation?
For #357
Anything in particular you'd like reviewers to focus on?
Correct use of cursor & coordinates.
Have you considered any alternatives or workarounds?
Initially tried with
visitMethodInvocation
, but that also complained when inserting more than one statement, even when part of the same JavaTemplate string.Checklist
./gradlew licenseFormat