Package org.jacoco.core.analysis

Examples of org.jacoco.core.analysis.ICoverageNode


    assertTrue(column.getComparator().compare(i2, i1) > 0);
    doc.close();
  }

  private ITableItem createItem(final String name, final String link) {
    final ICoverageNode node = new CoverageNodeImpl(ElementType.GROUP, name);
    return new ITableItem() {
      public String getLinkLabel() {
        return name;
      }

      public String getLink(ReportOutputFolder base) {
        return link;
      }

      public String getLinkStyle() {
        return Resources.getElementStyle(node.getElementType());
      }

      public ICoverageNode getNode() {
        return node;
      }
View Full Code Here


    assertEquals(0, c.compare(i1, i1));
    doc.close();
  }

  private ITableItem createItem(final int missed, final int covered) {
    final ICoverageNode node = createNode(missed, covered);
    return new ITableItem() {
      public String getLinkLabel() {
        return "Foo";
      }

      public String getLink(ReportOutputFolder base) {
        return null;
      }

      public String getLinkStyle() {
        return Resources.getElementStyle(node.getElementType());
      }

      public ICoverageNode getNode() {
        return node;
      }
View Full Code Here

    assertEquals("org/jacoco/examples", data.getPackageName());
  }

  @Test
  public void testEmptyClass() {
    ICoverageNode data = new ClassCoverageImpl("Sample", 0, null,
        "java/lang/Object", new String[0]);
    assertEquals(CounterImpl.COUNTER_0_0, data.getInstructionCounter());
    assertEquals(CounterImpl.COUNTER_0_0, data.getBranchCounter());
    assertEquals(CounterImpl.COUNTER_0_0, data.getMethodCounter());
    assertEquals(CounterImpl.COUNTER_1_0, data.getClassCounter());
  }
View Full Code Here

        node.getSignature());
  }

  @Test
  public void testEmptyMethod() {
    ICoverageNode node = new MethodCoverageImpl("sample", "()V", null);

    assertEquals(CounterImpl.COUNTER_0_0, node.getInstructionCounter());
    assertEquals(CounterImpl.COUNTER_0_0, node.getBranchCounter());
    assertEquals(CounterImpl.COUNTER_0_0, node.getLineCounter());
    assertEquals(CounterImpl.COUNTER_0_0, node.getComplexityCounter());
    assertEquals(CounterImpl.COUNTER_0_0, node.getMethodCounter());
    assertEquals(CounterImpl.COUNTER_0_0, node.getClassCounter());
  }
View Full Code Here

    return false;
  }

  protected ISourceNode findSourceCoverageForElement(Object element) {
    // Do we have a coverage info for the editor input?
    ICoverageNode coverage = CoverageTools.getCoverageInfo(element);
    if (coverage == null)
      return null;

    // TODO check resource timestamp
    // Does the resource version (if any) corresponds to the coverage data?
View Full Code Here

    viewer.addFilter(new ViewerFilter() {
      public boolean select(Viewer viewer, Object parentElement, Object element) {
        if (element == LOADING_ELEMENT) {
          return true;
        } else {
          final ICoverageNode c = CoverageTools.getCoverageInfo(element);
          if (c == null) {
            return false;
          }
          final ICounter instructions = c.getInstructionCounter();
          if (instructions.getTotalCount() == 0) {
            return false;
          }
          if (settings.getHideUnusedElements()
              && instructions.getCoveredCount() == 0) {
View Full Code Here

  }

  private int calculateMaxTotal(IJavaElement parent) {
    int max = 0;
    for (Object sibling : contentProvider.getChildren(parent)) {
      final ICoverageNode coverage = CoverageTools.getCoverageInfo(sibling);
      if (coverage != null) {
        max = Math.max(max, coverage.getCounter(settings.getCounters())
            .getTotalCount());
      }
    }
    return max;
  }
View Full Code Here

    column.getColumn().setWidth(convertWidthInCharsToPixels(width));
    column.setLabelProvider(labelProvider);
  }

  private Line[] getLines() {
    ICoverageNode c = CoverageTools.getCoverageInfo(getElement());
    if (c == null) {
      return new Line[0];
    } else {
      return new Line[] {
          new Line(UIMessages.CoveragePropertyPageInstructions_label,
              c.getInstructionCounter()),
          new Line(UIMessages.CoveragePropertyPageBranches_label,
              c.getBranchCounter()),
          new Line(UIMessages.CoveragePropertyPageLines_label,
              c.getLineCounter()),
          new Line(UIMessages.CoveragePropertyPageMethods_label,
              c.getMethodCounter()),
          new Line(UIMessages.CoveragePropertyPageTypes_label,
              c.getClassCounter()),
          new Line(UIMessages.CoveragePropertyPageComplexity_label,
              c.getComplexityCounter()) };
    }
  }
View Full Code Here

    viewer.addFilter(new ViewerFilter() {
      public boolean select(Viewer viewer, Object parentElement, Object element) {
        if (element == LOADING_ELEMENT) {
          return true;
        } else {
          ICoverageNode c = CoverageTools.getCoverageInfo(element);
          if (c == null || c.getInstructionCounter().getTotalCount() == 0) {
            return false;
          }
          if (settings.getHideUnusedTypes()) {
            ICounter cnt = c.getClassCounter();
            return cnt.getTotalCount() == 0 || cnt.getCoveredCount() != 0;
          }
          return true;
        }
      }
View Full Code Here

    IType[] arr = new IType[types.size()];
    return types.toArray(arr);
  }

  public ICoverageNode getCoverageFor(IJavaElement element) {
    final ICoverageNode coverage = coveragemap.get(element);
    if (coverage != null) {
      return coverage;
    }
    if (IJavaElement.METHOD == element.getElementType()) {
      resolveMethods((IType) element.getParent());
View Full Code Here

TOP

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

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.