Package org.jacoco.core.analysis

Examples of org.jacoco.core.analysis.ICounter


    assertFalse(c1.equals(c2));
  }

  @Test
  public void testEquals3() {
    ICounter c1 = CounterImpl.getInstance(300, 123);
    ICounter c2 = CounterImpl.getInstance(300, 124);
    assertFalse(c1.equals(c2));
  }
View Full Code Here


    assertFalse(c1.equals(c2));
  }

  @Test
  public void testEquals4() {
    ICounter c = CounterImpl.getInstance(300, 123);
    assertFalse(c.equals(new Integer(123)));
  }
View Full Code Here

    assertFalse(c.equals(new Integer(123)));
  }

  @Test
  public void testHashCode1() {
    ICounter c1 = CounterImpl.getInstance(300, 123);
    ICounter c2 = CounterImpl.getInstance(300, 123);
    assertEquals(c1.hashCode(), c2.hashCode());
  }
View Full Code Here

    assertEquals(c1.hashCode(), c2.hashCode());
  }

  @Test
  public void testHashCode2() {
    ICounter c1 = CounterImpl.getInstance(300, 123);
    ICounter c2 = CounterImpl.getInstance(400, 123);
    assertFalse(c1.hashCode() == c2.hashCode());
  }
View Full Code Here

    assertFalse(c1.hashCode() == c2.hashCode());
  }

  @Test
  public void testHashCode3() {
    ICounter c1 = CounterImpl.getInstance(300, 123);
    ICounter c2 = CounterImpl.getInstance(300, 124);
    assertFalse(c1.hashCode() == c2.hashCode());
  }
View Full Code Here

    assertFalse(c1.hashCode() == c2.hashCode());
  }

  @Test
  public void testToString() {
    ICounter c = CounterImpl.getInstance(300, 123);
    assertEquals("Counter[300/123]", c.toString());
  }
View Full Code Here

   * @throws IOException
   */
  public static void writeCounters(final ICoverageNode node,
      final XMLElement parent) throws IOException {
    for (final CounterEntity counterEntity : CounterEntity.values()) {
      final ICounter counter = node.getCounter(counterEntity);
      if (counter.getTotalCount() > 0) {
        final XMLElement counterNode = parent.element("counter");
        counterNode.attr("type", counterEntity.name());
        writeCounter(counterNode, "missed", "covered", counter);
        counterNode.close();
      }
View Full Code Here

        node.getSignature(), node.getSuperName(),
        node.getInterfaceNames());
    writer.write(className);

    for (final CounterEntity entity : COUNTERS) {
      final ICounter counter = node.getCounter(entity);
      writer.write(counter.getMissedCount());
      writer.write(counter.getCoveredCount());
    }

    writer.nextLine();
  }
View Full Code Here

      }

      @Override
      protected void paint(Event event, Object element) {
        if (element != LOADING_ELEMENT) {
          ICounter counter = CoverageTools.getCoverageInfo(element).getCounter(
              settings.getCounters());
          RedGreenBar.draw(event, column1.getColumn().getWidth(), counter,
              maxTotalCache.getMaxTotal(element));
        }
      }
    });
    sorter.addColumn(column1, COLUMN_RATIO);

    final TreeViewerColumn column2 = new TreeViewerColumn(viewer, SWT.RIGHT);
    column2.setLabelProvider(new CellLabelProvider() {

      @Override
      public void update(ViewerCell cell) {
        if (cell.getElement() == LOADING_ELEMENT) {
          cell.setText(""); //$NON-NLS-1$
        } else {
          cell.setText(cellTextConverter.getCovered(cell.getElement()));
        }
      }
    });
    sorter.addColumn(column2, COLUMN_COVERED);

    final TreeViewerColumn column3 = new TreeViewerColumn(viewer, SWT.RIGHT);
    column3.setLabelProvider(new CellLabelProvider() {

      @Override
      public void update(ViewerCell cell) {
        if (cell.getElement() == LOADING_ELEMENT) {
          cell.setText(""); //$NON-NLS-1$
        } else {
          cell.setText(cellTextConverter.getMissed(cell.getElement()));
        }
      }
    });
    sorter.addColumn(column3, COLUMN_MISSED);

    final TreeViewerColumn column4 = new TreeViewerColumn(viewer, SWT.RIGHT);
    column4.setLabelProvider(new CellLabelProvider() {

      @Override
      public void update(ViewerCell cell) {
        if (cell.getElement() == LOADING_ELEMENT) {
          cell.setText(""); //$NON-NLS-1$
        } else {
          cell.setText(cellTextConverter.getTotal(cell.getElement()));
        }
      }
    });
    sorter.addColumn(column4, COLUMN_TOTAL);

    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) {
            return false;
          }
          return true;
        }
      }
View Full Code Here

    }
    return workbenchLabelProvider.getText(element);
  }

  String getRatio(Object element) {
    ICounter counter = getCounter(element);
    if (counter.getTotalCount() == 0) {
      return ""; //$NON-NLS-1$
    } else {
      return COVERAGE_VALUE.format(counter.getCoveredRatio());
    }
  }
View Full Code Here

TOP

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

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.