Do you have any JUnit tests that have assertions like this?
Whew, that's a nasty
assertFalse. Let's see,
List.isEmpty(), but the negation of that, and we don't want that negation to be true... yikes. Far better to rewrite this as:
Much, much clearer. Not coincidentally, the recently released PMD 3.6 has a SimplifyBooleanAssertion rule that will catch just this problem. Thanks to Xavier Le Vourch for coding up this rule! And thanks to Elliotte Rusty Harold for mentioning it on Cafe Au Lait.