rewrite-testing-frameworks
rewrite-testing-frameworks copied to clipboard
added recipe to collapse consecutive AssertThat statements (#373)
Closes #373
Hi 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?
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 after in the JRightPadded element. However, facing difficulty to set whitespace correctly.
Glad to see how far this has come! I think we can just adjust the after values to include and additional level of indentation; That's the only remaining issue right?
Glad to see how far this has come! I think we can just adjust the
aftervalues to include and additional level of indentation; That's the only remaining issue right?
That's correct.