Rule is java:S2187 - TestCases should contain tests (SonarQube v9.9)
We have number of places where a superclass contains a set of tests and then one or more sub-classes provide different configurations or inputs for those tests but no additional tests. Something like the following …
public class ReferencesResolverSLDTest extends ReferencesResolverTest
{
@Before
@Override
public void setUp() throws Exception
{
super.setUp();
switchLegacyMode(false); // superclass has legacy mode set to true
}
The java:S2187 rule complains that the subclass has no test methods but it does because it inherits and reuses the tests from it superclass. This gives us loads of false positives. Could the rule be modified to check if the class inherits tests from a superclass?