Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[java] #940 Avoid JUnit 4 false positives for JUnit 5 tests #1256
Added JUnit5 annotations to XPath which identify JUnit methods (tests, setup, teardown), so that PMD doesn't report false positives for JUnit5 tests.
A minimal example of a false positive is the following JUnit5 test:
PMD 6.5 reports: "JUnit 4 tests that execute tests should use the @test annotation".
@vovkss thanks for the PR! This looks great, but it's missing test cases. Each rule has a test data xml file (named after the rule) on which scenarios to be tested are described. For instance, the
I'd also consider updating the descriptions for these rules. The rules are intended for JUnit 4. Having them work on both Junit 4 and 5 is sweet, but should be properly stated to users.