I'm using:
mvn cobertura:cobertura
to generate a coverage report for a project. This isn't actually configured in the pom.xml file, so it's just using the latest version of the plugin (currently 2.6).
For the most part this works ok, but for some reason one class has a very odd report. It seems to be reporting that some lines have been covered, but other lines (which are right next to it) are not.
I've been running:
mvn clean
Of course, but that doesn't seem to help.
Overall it's only reporting about 1% coverage, but this is actually quite a key class that I know is getting used a lot. I also know that the reports used to work ok. I'm not sure when they stopped working, as I've not inspected that class's coverage for a while.
As an example of what I'm seeing:
2053 private final List<EntityProperty<T>> properties = new ArrayList<EntityProperty<T>>();
private final PropertyDescriptor idProperty;
0 private final Set<String> fieldOrder = new LinkedHashSet<String>();
0 private final Map<String, String> additionalFieldLabels = new HashMap<String, String>();
This is from the initialiser of the class. The first line apparently gets called 2053 time. The 2nd line doesn't actually run any code, so is left blank (as indicated), but the 3rd and 4th lines both report being called 0 times.
Another example:
2053 public EntityIntrospector(AdminApp app, EntityApplication entityApp, Class<T> entityClass) {
0 this.app = app;
From the constructor itself. Again the first line is called 2053 times, but the 2nd (and all other lines in the constructor) are called 0 times.
Anyway I'm at a loss as to why this is happening.
I suspect that maybe it's another library somehow interfering with the coverage/instrumentation somehow.
Possibly the class size could be a factor. The source file itself is a pretty weighty 2040 lines long (918 actual lines of code that count towards coverage).
I've been writing other tests and code over the last few days and cobertura is working fine for those.
Hints and suggestions welcome.