This rule is Obsolete | |
Synopsis: | assertTrue(true) or similar statements are unnecessary |
Language: | Java |
Severity Level: | 5 |
Category: | JUnit |
Description: |
A JUnit test assertion with a boolean literal is unnecessary since it always will eval to the same thing.
Consider using flow control (in case of assertTrue(false) or similar) or simply removing
statements like assertTrue(true) and assertFalse(false). If you just want a test to halt, use the fail method.public class SimpleTest extends TestCase { public void testX() { // Why on earth would you write this? assertTrue(true); } } |