Search in sources :

Example 1 with CounterEntity

use of org.jacoco.core.analysis.ICoverageNode.CounterEntity in project jacoco by jacoco.

the class ClassRowWriter method writeHeader.

private void writeHeader() throws IOException {
    writer.write("GROUP", "PACKAGE", "CLASS");
    for (final CounterEntity entity : COUNTERS) {
        writer.write(entity.name() + "_MISSED");
        writer.write(entity.name() + "_COVERED");
    }
    writer.nextLine();
}
Also used : CounterEntity(org.jacoco.core.analysis.ICoverageNode.CounterEntity)

Example 2 with CounterEntity

use of org.jacoco.core.analysis.ICoverageNode.CounterEntity in project jacoco by jacoco.

the class ClassRowWriter method writeRow.

/**
 * Writes the class summary information as a row.
 *
 * @param groupName
 *            name of the group
 * @param packageName
 *            vm name of the package
 * @param node
 *            class coverage data
 * @throws IOException
 *             in case of problems with the writer
 */
public void writeRow(final String groupName, final String packageName, final IClassCoverage node) throws IOException {
    writer.write(groupName);
    writer.write(languageNames.getPackageName(packageName));
    final String className = languageNames.getClassName(node.getName(), 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();
}
Also used : ICounter(org.jacoco.core.analysis.ICounter) CounterEntity(org.jacoco.core.analysis.ICoverageNode.CounterEntity)

Example 3 with CounterEntity

use of org.jacoco.core.analysis.ICoverageNode.CounterEntity in project jacoco by jacoco.

the class XMLCoverageWriter method writeCounters.

/**
 * Writes all non-zero counters of the given node.
 *
 * @param node
 *            node to retrieve counters from
 * @param parent
 *            container for the counter elements
 * @throws IOException
 *             if XML can't be written to the underlying output
 */
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();
        }
    }
}
Also used : ICounter(org.jacoco.core.analysis.ICounter) CounterEntity(org.jacoco.core.analysis.ICoverageNode.CounterEntity)

Aggregations

CounterEntity (org.jacoco.core.analysis.ICoverageNode.CounterEntity)3 ICounter (org.jacoco.core.analysis.ICounter)2