What is the meaning of red check mark at class declaration level in Cobertura Maven Plugin report?

665 views Asked by At

I have a project with several tests and Cobertura Maven Plugin. All works fine but one Class with its test are driving me crazy.

This is the cobertura report with 83% of line coverage:

r1

And this is the basic test:

import static org.junit.Assert.assertEquals;
import org.junit.Test;

public class TimeHelperTest {

  @Test
  public void elapsedMillisToHumanExpression() throws Exception {
    assertEquals("0 min 3 seg 600 millis",
        TimeHelper.elapsedMillisToHumanExpression(1000000000l, 1000003600l));
  }

}

Question

  • What means 0 at the left of class name in cobertura report?

Other classes show numbers > 0 and are green.

enter image description here

Environment

  • java 8
  • ubuntu
  • eclipse
  • pom.xml
<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>cobertura-maven-plugin</artifactId>
      <version>2.7</version>
      <configuration>
        <check>
          <haltOnFailure>true</haltOnFailure>
          <branchRate>90</branchRate>
          <lineRate>90</lineRate>
          <totalBranchRate>90</totalBranchRate>
          <totalLineRate>90</totalLineRate>
          <packageLineRate>90</packageLineRate>
          <packageBranchRate>90</packageBranchRate>
        </check>
        <formats>
          <format>html</format>
        </formats>
      </configuration>
      <executions>
        <execution>
          <id>cobertura-clean-and-check</id>
          <phase>prepare-package</phase>
          <goals>
            <goal>clean</goal>
            <goal>cobertura</goal>
            <goal>check</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Attempts

I tried with several changes in my @Test but report does not change !!

  • use extends TestCase
  • use @RunWith
  • use maven-surefire-plugin including **/*Test.java
  • remove thresholds in pom.xml

Research

1

There are 1 answers

0
darker On

it means default constructor is not tested.maybe, you can add a test method to new TimeHelper() for resolve it.