Collapse consecutive assertThat statements (#373)#392
Collapse consecutive assertThat statements (#373)#392timtebeek merged 27 commits intoopenrewrite:mainfrom
assertThat statements (#373)#392Conversation
|
Really nice to see you picked this up @srmalkan! Impressed with how much of the recipe already works. I've explored locally if I could get the indentation to work, but no such luck yet either. I'd expected the fix to be in setting a prefix on each of the method invocations where we change the select, but I've not yet found a working combination. Will try to explore later again. |
|
Yes, i thought so too. After looking at few objects, now i feel its related to setting up 'after' correctly in JRightPadded. |
|
Hi @timtebeek, I was able to fix formatting by setting |
|
Glad to see how far this has come! I think we can just adjust the |
That's correct. |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…secutiveAssertThatStatements.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
assertThat statements (#373)
assertThat(..)statements that each use the same object to a single statement #373Hi All,
I have added a recipe to collapse if consecutive AssertThat statements on the same parameter are found. It ignores cases where the parameter is a Method Invocation or lambda or existing chained assertThat statement.
I am facing a bit of difficulty in formatting the chained assertThat statement, can someone guide me on that?