public abstract class GenericTests<T extends Number> {
protected abstract T getT();
@Test public void test1() {
getT();
}
}
public class ConcreteTests1 extends GenericTests<Integer> { ... }
public class ConcreteTests2 extends GenericTests<Double> { ... }
No tests are executed at all, both concrete classes are ignored. How do I make it work? (I expect test1()
to be executed for both Integer
and Double
).
I use JUnit 4.8.1.
Update: it appeared that problem is related with maven-surefire-plugin and not JUnit itself. See my answer below.
Renamed all my classes to have suffix "Test" and now it works (Concrete1Test
, Concrete2Test
).
Update:
That's related with default settings of maven-surefire-plugin.
http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html
By default, the Surefire Plugin will automatically include all test classes with the following wildcard patterns:
**/Test*.java
- includes all of its subdirectories and all java filenames that start with "Test".**/*Test.java
- includes all of its subdirectories and all java filenames that end with "Test".**/*TestCase.java
- includes all of its subdirectories and all java filenames that end with "TestCase".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With