Subclass of JUnit 4 annotation-based test won't be properly recognized as a JUnit test unless it contains at least one @Test annotated method, hence the Run test option is not available.
Consider the following example:
public class AbstractRepositoryTest {
private Repository repository;
protected AbstractRepositoryTest(Repository repository){
this.repository = repository;
}
@Test
public void testStore() {
.....
}
}
and the subclass:
public class MyRepositoryTest extends AbstractRepositoryTest {
public MyRepositoryTest() {
super(new MyRepository());
}
}
This is a very useful technique for verifying the same contract for different implementations. I do not want to add test-methods in the subclass. but if I do, the run test option is available and all the tests are executed properly.