TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

Rule:  JUnit10Checked automatically with code checker

This rule is Obsolete
Synopsis:assertTrue(!expr) can be replaced by assertFalse(expr)
Language:Java
Severity Level:5
Category:JUnit


Description:
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()); // replace with assertFalse("not empty", r.isEmpty())
  assertFalse(!r.isEmpty()); // replace with assertTrue(r.isEmpty())
 }
}