Affects PMD Version:
7.0.0-rc3
Rule:
JUnit4TestShouldUseTestAnnotation
Description:
Rule complaints about missing @Test
annotation even if it is present, but from org.testng.annotations
package.
Probably TestNG org.testng.annotations.Test
annotation is missing in rule definition: https://github.com/pmd/pmd/blob/3e2de671907a2b2984880e50105072fd6c26116c/pmd-java/src/main/resources/category/java/bestpractices.xml#L783C75-L783C75
Code Sample demonstrating the issue:
import org.testng.annotations.Test; public class A { @Test void test() {} // report warning }
Expected outcome:
PMD reports a violation: JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
at line 4, but that's wrong - @Test
annotation is present by the test method.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4