Invert arguments on JUnity assertEquals

Answered

For some reason we have a large amount of JUnity "assertEquals" that have the "expected" and "actual" arguments inverted:

assertEquals(<actual>, <expected>);

instead of

assertEquals(<expected>, <actual>);

Any chance of a spell to swap them?

0
2 comments

Not sure IntelliJ IDEA caused it. 

You can revert them back using structural replace: https://www.jetbrains.com/help/idea/structural-search-and-replace.html

0
Avatar
Permanently deleted user

That's perfect, it worked, that's a very powerful feature! 

Looks like the code inspection use that right, very interesting indeed.

Anyway thanks! 

BTW, it was not IntelliJ, it was always like this, we just hadn't noticed.

0

Please sign in to leave a comment.