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

Rule:  JUnit7Checked automatically with code checker

This rule is Obsolete
Synopsis:Use assertEquals(x, y) instead of assertTrue(x.equals(y))
Language:Java
Severity Level:4
Category:JUnit


Description:
This rule detects JUnit assertions in object equality. These assertions should be made by more specific methods, like assertEquals.
public class FooTest extends TestCase {
 void testCode() {
  Object a, b;
  assertTrue(a.equals(b)); // bad usage
  assertEquals(?a should equals b?, a, b); // good usage
 }
}