Search in sources :

Example 1 with ClassCoverageImpl

use of org.jacoco.core.internal.analysis.ClassCoverageImpl in project jacoco by jacoco.

the class CoverageBuilderTest method addClass.

private void addClass(long id, boolean nomatch, String name, String source, MethodCoverageImpl... methods) {
    final ClassCoverageImpl coverage = new ClassCoverageImpl(name, id, nomatch);
    coverage.setSourceFileName(source);
    for (MethodCoverageImpl m : methods) {
        coverage.addMethod(m);
    }
    coverageBuilder.visitCoverage(coverage);
}
Also used : ClassCoverageImpl(org.jacoco.core.internal.analysis.ClassCoverageImpl) MethodCoverageImpl(org.jacoco.core.internal.analysis.MethodCoverageImpl)

Example 2 with ClassCoverageImpl

use of org.jacoco.core.internal.analysis.ClassCoverageImpl in project jacoco by jacoco.

the class BundleCheckerTest method createBundle.

private IBundleCoverage createBundle() {
    final MethodCoverageImpl m = new MethodCoverageImpl("fooMethod", "()V", null);
    m.increment(CounterImpl.getInstance(5, 5), CounterImpl.COUNTER_0_0, 1);
    m.incrementMethodCounter();
    final ClassCoverageImpl c = new ClassCoverageImpl("org/jacoco/example/FooClass", 1001, false);
    c.setSourceFileName("FooClass.java");
    c.addMethod(m);
    final SourceFileCoverageImpl s = new SourceFileCoverageImpl("FooClass.java", "org/jacoco/example");
    s.increment(c);
    IPackageCoverage p = new PackageCoverageImpl("org/jacoco/example", Collections.singleton((IClassCoverage) c), Collections.singleton((ISourceFileCoverage) s));
    return new BundleCoverageImpl("Test", Collections.singleton(p));
}
Also used : IPackageCoverage(org.jacoco.core.analysis.IPackageCoverage) PackageCoverageImpl(org.jacoco.core.internal.analysis.PackageCoverageImpl) IClassCoverage(org.jacoco.core.analysis.IClassCoverage) ISourceFileCoverage(org.jacoco.core.analysis.ISourceFileCoverage) BundleCoverageImpl(org.jacoco.core.internal.analysis.BundleCoverageImpl) ClassCoverageImpl(org.jacoco.core.internal.analysis.ClassCoverageImpl) MethodCoverageImpl(org.jacoco.core.internal.analysis.MethodCoverageImpl) SourceFileCoverageImpl(org.jacoco.core.internal.analysis.SourceFileCoverageImpl)

Example 3 with ClassCoverageImpl

use of org.jacoco.core.internal.analysis.ClassCoverageImpl in project jacoco by jacoco.

the class ClassRowWriterTest method TestRow.

@Test
public void TestRow() throws Exception {
    IClassCoverage node = new ClassCoverageImpl("test/package/Foo", 123, false) {

        {
            instructionCounter = CounterImpl.getInstance(1, 11);
            branchCounter = CounterImpl.getInstance(2, 22);
            lineCounter = CounterImpl.getInstance(3, 33);
            complexityCounter = CounterImpl.getInstance(4, 44);
            methodCounter = CounterImpl.getInstance(5, 55);
            classCounter = CounterImpl.getInstance(6, 66);
        }
    };
    writer.writeRow("group", "test/package", node);
    BufferedReader reader = getResultReader();
    reader.readLine();
    assertEquals("group,test/package,test/package/Foo,1,11,2,22,3,33,4,44,5,55", reader.readLine());
}
Also used : IClassCoverage(org.jacoco.core.analysis.IClassCoverage) ClassCoverageImpl(org.jacoco.core.internal.analysis.ClassCoverageImpl) BufferedReader(java.io.BufferedReader) Test(org.junit.Test)

Example 4 with ClassCoverageImpl

use of org.jacoco.core.internal.analysis.ClassCoverageImpl in project jacoco by jacoco.

the class ClassPageTest method setup.

@Before
@Override
public void setup() throws Exception {
    super.setup();
    node = new ClassCoverageImpl("org/jacoco/example/Foo", 123, false);
    node.addMethod(new MethodCoverageImpl("a", "()V", null));
    node.addMethod(new MethodCoverageImpl("b", "()V", null));
    node.addMethod(new MethodCoverageImpl("c", "()V", null));
}
Also used : ClassCoverageImpl(org.jacoco.core.internal.analysis.ClassCoverageImpl) MethodCoverageImpl(org.jacoco.core.internal.analysis.MethodCoverageImpl) Before(org.junit.Before)

Example 5 with ClassCoverageImpl

use of org.jacoco.core.internal.analysis.ClassCoverageImpl in project jacoco by jacoco.

the class ClassPageTest method testGetFileNameDefault.

@Test
public void testGetFileNameDefault() throws IOException {
    IClassCoverage defaultNode = new ClassCoverageImpl("Foo", 123, false);
    page = new ClassPage(defaultNode, null, null, rootFolder, context);
    assertEquals("Foo.html", page.getFileName());
}
Also used : IClassCoverage(org.jacoco.core.analysis.IClassCoverage) ClassCoverageImpl(org.jacoco.core.internal.analysis.ClassCoverageImpl) Test(org.junit.Test)

Aggregations

ClassCoverageImpl (org.jacoco.core.internal.analysis.ClassCoverageImpl)8 IClassCoverage (org.jacoco.core.analysis.IClassCoverage)5 Test (org.junit.Test)4 ISourceFileCoverage (org.jacoco.core.analysis.ISourceFileCoverage)3 MethodCoverageImpl (org.jacoco.core.internal.analysis.MethodCoverageImpl)3 PackageCoverageImpl (org.jacoco.core.internal.analysis.PackageCoverageImpl)3 SourceFileCoverageImpl (org.jacoco.core.internal.analysis.SourceFileCoverageImpl)2 Document (org.w3c.dom.Document)2 BufferedReader (java.io.BufferedReader)1 IPackageCoverage (org.jacoco.core.analysis.IPackageCoverage)1 ExecutionData (org.jacoco.core.data.ExecutionData)1 BundleCoverageImpl (org.jacoco.core.internal.analysis.BundleCoverageImpl)1 ClassAnalyzer (org.jacoco.core.internal.analysis.ClassAnalyzer)1 ClassProbesAdapter (org.jacoco.core.internal.flow.ClassProbesAdapter)1 Before (org.junit.Before)1