All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.pmd.rules.pmd-unit-tests.UseAssertTrueInsteadOfAssertEquals.html Maven / Gradle / Ivy

The newest version!
When asserting a value is the same as a boolean literal, use assertTrue/assertFalse, instead of assertEquals. Example:
public class MyTestCase extends TestCase {
	public void testMyCase() {
		boolean myVar = true;
		// Ok
		assertTrue("myVar is true", myVar);
		// Bad
		assertEquals("myVar is true", true, myVar);
		// Bad
		assertEquals("myVar is false", false, myVar);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy