All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.pmd.rules.pmd-unit-tests.SimplifyBooleanAssertion.html Maven / Gradle / Ivy

The newest version!
Avoid negation in an assertTrue or assertFalse test. For example, rephrase: assertTrue(!expr); as: assertFalse(expr);
public class SimpleTest extends TestCase {
  public void testX() {
    assertTrue("not empty", !r.isEmpty()); // violation, replace with assertFalse("not empty", r.isEmpty())
    assertFalse(!r.isEmpty()); // violation, replace with assertTrue("empty", r.isEmpty())
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy