Closed jtymes closed 4 weeks ago
Thanks for the clear & runnable report! Indeed looks like we ought to be slightly more conservative in reusing the exact argument passed into contains
, not just the select
that might be in there. Really helpful to have a unit test to step through. Are you already close to a fix? Welcome to open a draft PR even when all you have is a test; that helps us explore & collaborate as well.
@timtebeek I don't have a fix yet, but I added the test in #629 to get things rolling.
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a single module project.
What is the smallest, simplest way to reproduce the problem?
I recreated this with a test, basically copying the existing
stringContains()
test. This shows the expectation:What did you expect to see?
What did you see instead?
What is the full stack trace of any errors you encountered?
No stack, just incorrect replacement.
It appears to be related to the
SimplifyChainedAssertJAssertion.extractEitherArgument
method wheregetSelect()
is chosen.Are you interested in contributing a fix to OpenRewrite?
Yes, if I understand the requirements around the use of
getSelect()
instead of the fullJ.MethodInvocation
.