A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/2636 below:

[java] TestClassWithoutTestCases false positive with JUnit5 ParameterizedTest · Issue #2636 · pmd/pmd · GitHub

Affects PMD Version: 6.10.0

Rule: TestClassWithoutTestCases

Description:

When a test class is extended from some parent class, the following check is triggered:
This class name ends with Test but contains no test cases (TestClassWithoutTestCases)
Probably its being misidentified as Junit 3.

final class SampleTest extends Object {

    @ParameterizedTest
    @ValueSource(ints = {1})
    void doesTest(final int num) {
        Assertions.assertTrue(num > 0);
    }
}

Test class which has no parent works fine, but empty class is not producing an error too (probably worth a separate issue).

final class SampleTest {
}

Expected outcome:

No error occurs when @ParameterizedTest is used inside a test class with a parent.


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