/** * Creates a 'counter' element. * * @param counterEntity * entity of this counter * * @param counter * counter object to write out * * @throws IOException * in case of problems with the underlying output */ public void counter(final CounterEntity counterEntity, final ICounter counter) throws IOException { final ReportElement counterNode = element("counter"); counterNode.attr("type", counterEntity.name()); counterAttributes(counterNode, "missed", "covered", counter); }
/** * Sets the counter entity to check. * * @param entity * counter entity to check * TODO: use CounterEntity directly once Maven 3 is required. */ public void setCounter(final String entity) { this.entity = CounterEntity.valueOf(entity); }
/** * 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 ReportElement parent) throws IOException { for (final CounterEntity counterEntity : CounterEntity.values()) { final ICounter counter = node.getCounter(counterEntity); if (counter.getTotalCount() > 0) { parent.counter(counterEntity, counter); } } }