We have a lot of AssertJ assertions to which we have attempted to give readable names, but we actually have the method calls in the wrong order.
The .as(description) call must appear before the actual assertion check, like this:
not like this:
(IntelliJ actually marks the as call as suspicious, because its result is never used.)
This regex search via ripgrep should show the vast majority of them (with very few false positives):
After those are cleaned up, it might be worth glancing at the results for this too (in case some of the descriptions include parens):
IntelliJ IDEA's Structural Search (and Replace) proves to be a better choice than regexes, especially for bulk fixes:
Most of the fixes were done by replacing this search template:
with this replacement template:
One gotcha so far: one of the statements included a comment in its middle (after the assertion, before as()), but the replacement discarded it.