Examples of IReportVisitor


Examples of org.jacoco.report.IReportVisitor

  public IReportVisitor visitChild(final ICoverageNode node)
      throws IOException {
    if (node.getElementType() == ElementType.CLASS) {
      return new ClassNode(this, node);
    } else if (node.getElementType() == ElementType.SOURCEFILE) {
      return new IReportVisitor() {

        public void visitEnd(final ISourceFileLocator sourceFileLocator)
            throws IOException {
        }
View Full Code Here

Examples of org.jacoco.report.IReportVisitor

  @Override
  public void execute() throws BuildException {
    loadExecutionData();
    try {
      final IReportVisitor visitor = createVisitor();
      visitor.visitInfo(sessionInfoStore.getInfos(),
          executionDataStore.getContents());
      createReport(visitor, structure);
      visitor.visitEnd();
    } catch (final IOException e) {
      throw new BuildException("Error while creating report.", e);
    }
  }
View Full Code Here

Examples of org.jacoco.report.IReportVisitor

      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

Examples of org.jacoco.report.IReportVisitor

  @Test
  public void testSessionInfo() throws Exception {
    infos.add(new SessionInfo("session-1", 12345, 67890));
    infos.add(new SessionInfo("session-2", 1, 2));
    infos.add(new SessionInfo("session-3", 1, 2));
    final IReportVisitor visitor = formatter.createVisitor(output);
    visitor.visitInfo(infos, data);
    visitor.visitGroup("foo");
    visitor.visitEnd();
    assertPathMatches("session-1", "/report/sessioninfo[1]/@id");
    assertPathMatches("12345", "/report/sessioninfo[1]/@start");
    assertPathMatches("67890", "/report/sessioninfo[1]/@dump");
    assertPathMatches("session-2", "/report/sessioninfo[2]/@id");
    assertPathMatches("session-3", "/report/sessioninfo[3]/@id");
View Full Code Here

Examples of org.jacoco.report.IReportVisitor

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

  @Test
  public void testStructureWithNestedGroups() throws Exception {
    final IReportVisitor visitor = formatter.createVisitor(output);
    visitor.visitInfo(infos, data);
    driver.sendNestedGroups(visitor);
    assertPathMatches("report", "/report/@name");
    assertPathMatches("group1", "/report/group[1]/@name");
    assertPathMatches("group", "/report/group[1]/group[1]/@name");
    assertPathMatches("bundle", "/report/group[1]/group[1]/group[1]/@name");
View Full Code Here

Examples of org.jacoco.report.IReportVisitor

    assertPathMatches("bundle", "/report/group[2]/@name");
  }

  @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

Examples of org.jacoco.report.IReportVisitor

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

  @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

Examples of org.jacoco.report.IReportVisitor

    assertPathMatches("1", "report/counter[@type='CLASS']/@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

Examples of org.jacoco.report.IReportVisitor

  }

  @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

Examples of org.jacoco.report.IReportVisitor

    report = new XMLReportFile("UTF-8", output.createFile());
  }

  @Test
  public void testEmptyReport() throws Exception {
    IReportVisitor groupElement = report.visitChild(new BundleCoverage(
        "test", Arrays.<PackageCoverage> asList()));
    groupElement.visitEnd(nullSourceLocator);
    report.visitEnd(nullSourceLocator);

    assertPathMatches("test", "/report/group/@name");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.