JUnitAssertionsShouldIncludeMessage does not work
A source code analyzer
Brought to you by:
adangel,
juansotuyo
I don't get any warnings for Assertions without message.
For example the class
import static org.hamcrest.Matchers.containsString; import org.junit.Assert; import org.junit.Test; public class TestClass extends Assert { @Test public void test() { assertTrue(true); assertEquals("", ""); assertNull(null); assertThat("", containsString("")); } }
does not get any JUnitAssertionsShouldIncludeMessage marker
Thanks for the bug report. Unfortunately I can't reproduce the problem.
With PMD 5.3.5 I get 4 violations, one for each of the asserts.
Which version of PMD are you using?
Since PMD 5.3.0 (and pull request 50)
assertThat
is also detected correctly - earlier versions of PMD only detect 3 violations.Test case: https://github.com/pmd/pmd/commit/bc9379d9b460f6e02e5f001e16c84899005b6856
I'm using the latest pmd-eclipse from http://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site-latest/
I just rechecked that the rule is enabled and tried the above-mentioned code again. Nothing. No warning at all.