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

Rule:  JUnit8Checked automatically with code checker

This rule is Obsolete
Synopsis:Use assertSame(x, y) instead of assertTrue(x==y), or assertNotSame(x,y) vs assertFalse(x==y)
Language:Java
Severity Level:4
Category:JUnit


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