Package org.jacoco.report

Examples of org.jacoco.report.IReportVisitor


    assertPathMatches("session-3", "/report/sessioninfo[3]/@id");
  }

  @Test
  public void testStructureWithGroup() throws Exception {
    final IReportVisitor visitor = formatter.createVisitor(output);
    visitor.visitInfo(infos, data);
    driver.sendGroup(visitor);
    assertPathMatches("group", "/report/@name");
    assertPathMatches("bundle", "/report/group/@name");
    assertPathMatches("org/jacoco/example", "/report/group/package/@name");
    assertPathMatches("org/jacoco/example/FooClass",
View Full Code Here


    assertPathMatches("2", "report/counter[@type='INSTRUCTION']/@missed");
  }

  @Test
  public void testStructureWithBundleOnly() throws Exception {
    final IReportVisitor visitor = formatter.createVisitor(output);
    visitor.visitInfo(infos, data);
    driver.sendBundle(visitor);
    assertPathMatches("bundle", "/report/@name");
    assertPathMatches("org/jacoco/example", "/report/package/@name");
    assertPathMatches("org/jacoco/example/FooClass",
        "/report/package/class/@name");
View Full Code Here

    assertPathMatches("33", "report/counter[@type='BRANCH']/@covered");
  }

  @Test
  public void testDefaultEncoding() throws Exception {
    final IReportVisitor visitor = formatter.createVisitor(output);
    visitor.visitInfo(infos, data);
    driver.sendBundle(visitor);
    final BufferedReader reader = new BufferedReader(new InputStreamReader(
        output.getContentsAsStream(), "UTF-8"));
    final String line = reader.readLine();
    assertTrue(line,
View Full Code Here

  }

  @Test
  public void testSetEncoding() throws Exception {
    formatter.setOutputEncoding("UTF-16");
    final IReportVisitor visitor = formatter.createVisitor(output);
    visitor.visitInfo(infos, data);
    driver.sendBundle(visitor);
    final BufferedReader reader = new BufferedReader(new InputStreamReader(
        output.getContentsAsStream(), "UTF-16"));
    final String line = reader.readLine();
    assertTrue(line,
View Full Code Here

      throws IOException {
    final ReportOutputFolder root = new ReportOutputFolder(output);
    resources = new Resources(root);
    resources.copyResources();
    index = new ElementIndex(root);
    return new IReportVisitor() {

      private List<SessionInfo> sessionInfos;
      private Collection<ExecutionData> executionData;

      private HTMLGroupVisitor groupHandler;
View Full Code Here

  public void testStructureWithNestedGroups() throws IOException {
    final ICoverageNode root = new CoverageNodeImpl(ElementType.GROUP,
        "root", false);
    final List<SessionInfo> sessions = Collections.emptyList();
    final Collection<ExecutionData> data = Collections.emptyList();
    final IReportVisitor child = formatter.createReportVisitor(root,
        sessions, data);
    driver.sendGroup(child);
    driver.sendGroup(child);
    child.visitEnd(driver.sourceFileLocator);
    final List<String> lines = getLines();
    assertEquals(HEADER, lines.get(0));
    assertEquals(
        "root/group/bundle,org.jacoco.example,FooClass,0,1,0,0,0,0,0,0",
        lines.get(1));
View Full Code Here

          "Unable to read execution data file " + dataFile + ": "
              + e.getMessage(), e);
      return;
    }
    try {
      final IReportVisitor visitor = createVisitor();
      visitor.visitInfo(sessionInfoStore.getInfos(),
          executionDataStore.getContents());
      createReport(visitor);
      visitor.visitEnd();
    } catch (final Exception e) {
      getLog().error("Error while creating report: " + e.getMessage(), e);
    }
  }
View Full Code Here

        support.findStr(doc, "//report/package/@name"));
  }

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

        support.findStr(doc, "//report/package/class/@name"));
  }

  @Test
  public void testMethod() throws Exception {
    final IReportVisitor packageHandler = handler
        .visitChild(new CoverageNodeImpl(ElementType.PACKAGE,
            "org.jacoco.example"));
    final IReportVisitor classHandler = packageHandler
        .visitChild(new SourceNodeImpl(ElementType.CLASS, "Foo"));
    MethodCoverageImpl node = new MethodCoverageImpl("doit", "()V", null);
    node.increment(CounterImpl.COUNTER_1_0, CounterImpl.COUNTER_0_0, 15);
    classHandler.visitChild(node).visitEnd(null);
    classHandler.visitEnd(null);
    packageHandler.visitEnd(null);
    final Document doc = getDocument();
    assertEquals("doit",
        support.findStr(doc, "//report/package/class/method/@name"));
    assertEquals("()V",
View Full Code Here

        support.findStr(doc, "//report/package/class/method/@line"));
  }

  @Test
  public void testSourcefile() throws Exception {
    final IReportVisitor packageHandler = handler
        .visitChild(new CoverageNodeImpl(ElementType.PACKAGE,
            "org.jacoco.example"));
    final SourceNodeImpl node = new SourceNodeImpl(ElementType.SOURCEFILE,
        "Foo.java");
    node.increment(CounterImpl.getInstance(1, 2),
        CounterImpl.getInstance(3, 4), 12);
    packageHandler.visitChild(node).visitEnd(null);
    packageHandler.visitEnd(null);
    final Document doc = getDocument();
    assertEquals("Foo.java",
        support.findStr(doc, "//report/package/sourcefile/@name"));
    assertEquals("12",
        support.findStr(doc, "//report/package/sourcefile/line/@nr"));
View Full Code Here

TOP

Related Classes of org.jacoco.report.IReportVisitor

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.