Package org.jacoco.core.analysis

Examples of org.jacoco.core.analysis.CoverageNodeImpl


    assertEquals("Group1", support.findStr(doc, "//report/group/@name"));
  }

  @Test
  public void testCounters() throws Exception {
    final CoverageNodeImpl node = new CoverageNodeImpl(ElementType.GROUP,
        "Group1", false) {
      {
        classCounter = CounterImpl.getInstance(10, 1);
        methodCounter = CounterImpl.getInstance(20, 2);
        blockCounter = CounterImpl.getInstance(30, 3);
View Full Code Here


  }

  @Test
  public void testPackage() throws Exception {
    handler.visitChild(
        new CoverageNodeImpl(ElementType.PACKAGE, "org.jacoco.example",
            false)).visitEnd(null);
    final Document doc = getDocument();
    assertEquals("org.jacoco.example",
        support.findStr(doc, "//report/package/@name"));
  }
View Full Code Here

  }

  @Test
  public void testClass() throws Exception {
    final IReportVisitor packageHandler = handler
        .visitChild(new CoverageNodeImpl(ElementType.PACKAGE,
            "org.jacoco.example", false));
    packageHandler.visitChild(
        new CoverageNodeImpl(ElementType.CLASS, "Foo", true)).visitEnd(
        null);
    packageHandler.visitEnd(null);
    final Document doc = getDocument();
    assertEquals("Foo",
        support.findStr(doc, "//report/package/class/@name"));
View Full Code Here

  }

  @Test
  public void testMethod() throws Exception {
    final IReportVisitor packageHandler = handler
        .visitChild(new CoverageNodeImpl(ElementType.PACKAGE,
            "org.jacoco.example", false));
    final IReportVisitor classHandler = packageHandler
        .visitChild(new CoverageNodeImpl(ElementType.CLASS, "Foo", true));
    MethodCoverage node = new MethodCoverage("doit", "()V", null);
    node.addBlock(5, new int[] { 15, 16, 17 }, false);
    classHandler.visitChild(node).visitEnd(null);
    classHandler.visitEnd(null);
    packageHandler.visitEnd(null);
View Full Code Here

  }

  @Test
  public void testSourcefile() throws Exception {
    final IReportVisitor packageHandler = handler
        .visitChild(new CoverageNodeImpl(ElementType.PACKAGE,
            "org.jacoco.example", false));
    final CoverageNodeImpl node = new CoverageNodeImpl(
        ElementType.SOURCEFILE, "Foo.java", true) {
      {
        lines.increment(new int[] { 11, 13 }, false);
        lines.increment(new int[] { 13, 14 }, true);
      }
View Full Code Here

    }
  }

  private void createReport(final IReportFormatter formatter)
      throws IOException {
    final CoverageNodeImpl node = createNode(structure);
    final IReportVisitor visitor = formatter.createReportVisitor(node,
        sessionInfoStore.getInfos(), executionDataStore.getContents());
    final SourceFileCollection sourceFileLocator = new SourceFileCollection(
        structure.sourcefiles);
    if (node.getElementType() == ElementType.BUNDLE) {
      visitBundle(visitor, (IBundleCoverage) node, sourceFileLocator);
    } else {
      for (final GroupElement g : structure.children) {
        createReport(g, visitor, node);
      }
View Full Code Here

  }

  private void createReport(final GroupElement group,
      final IReportVisitor parentVisitor,
      final CoverageNodeImpl parentNode) throws IOException {
    final CoverageNodeImpl node = createNode(group);
    final IReportVisitor visitor = parentVisitor.visitChild(node);
    final SourceFileCollection sourceFileLocator = new SourceFileCollection(
        group.sourcefiles);
    if (node.getElementType() == ElementType.BUNDLE) {
      visitBundle(visitor, (IBundleCoverage) node, sourceFileLocator);
    } else {
      for (final GroupElement g : group.children) {
        createReport(g, visitor, node);
      }
View Full Code Here

    handler = new CSVPackageHandler(rw, "group", "package");
  }

  @Test(expected = AssertionError.class)
  public void testVisitChildNegative1() throws Exception {
    handler.visitChild(new CoverageNodeImpl(ElementType.GROUP, "Foo"));
  }
View Full Code Here

    handler.visitChild(new CoverageNodeImpl(ElementType.GROUP, "Foo"));
  }

  @Test(expected = AssertionError.class)
  public void testVisitChildNegative2() throws Exception {
    handler.visitChild(new CoverageNodeImpl(ElementType.BUNDLE, "Foo"));
  }
View Full Code Here

    handler.visitChild(new CoverageNodeImpl(ElementType.BUNDLE, "Foo"));
  }

  @Test(expected = AssertionError.class)
  public void testVisitChildNegative3() throws Exception {
    handler.visitChild(new CoverageNodeImpl(ElementType.PACKAGE, "Foo"));
  }
View Full Code Here

TOP

Related Classes of org.jacoco.core.analysis.CoverageNodeImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.