Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
This rule detects JUnit assertions in object references equality. These assertions should be made by more specific methods, like assertNull, assertNotNull.
public class FooTest extends TestCase {
  void testCode() {
    Object a = doSomething();

    assertTrue(a==null); // violation
    assertNull(a);  // good usage
    assertTrue(a != null); // violation
    assertNotNull(a);  // good usage
New to GrepCode? Check out our FAQ X