Rule "TestCases should contain tests" (squid:S2187) currently supports "@Test" annotations of JUnit 4+5 + TestNG, but not ParameterizedTest of JUnit 5, which leads to an issue if all tests of a testclass happen to be parameterized.
Responsible code is
sonar-java/java-checks/src/main/java/org/sonar/java/checks/NoTestInTestClassCheck.java
| private static boolean isTestAnnotation(Type type) { |
| return type.is("org.junit.Test") || type.is("org.testng.annotations.Test") || type.is("org.junit.jupiter.api.Test") |
| || type.symbol().metadata().isAnnotatedWith("org.junit.jupiter.api.Test"); |
}
I'd be happy to implement and contribute this myself, addition could be
as simple as extending following method to also check for
type.is("org.junit.jupiter.api.ParameterizedTest")
or to be a little more generic to check for type.symbol().metadata().isAnnotatedWith("org.junit.jupiter.api.TestTemplate")