-
Notifications
You must be signed in to change notification settings - Fork 238
JMockit Coverage including test class in coverage report #265
Description
In a project which follows the Maven Standard Directory Layout a test class will be included in the coverage report.
When the coverage report is generated the below is seen in the report.

I tried setting 'coverage-srcDirs=src/main/java', but while that did have an effect the test class was still listed. I also tried excluding the filename pattern but saw the same result.

When multiple test classes exist it is still only a single test class which gets included in the report.
I tested with some earlier versions and it looks like the problem was first introduced in 1.20 but is still reproducible in 1.22.
In the test project ClassOne and ClassOneTest were actually very small classes, as below for reference, with only a single method/test respectively. Though this does not appear to be any factor as I've seen this in more complex projects originally.
public class ClassOne {
public static ClassOne newClassOne() {
return new ClassOne();
}
}public class ClassOneTest {
@Test
public void testNewClassOne_classOneInstance() {
ClassOne classOne = ClassOne.newClassOne();
Assert.assertThat(classOne, CoreMatchers.instanceOf(ClassOne.class));
}
}