private List<IClassCoverage> getSameClassCoverage(String className, List<IClassCoverage> classCoverages) { return classCoverages.stream() .filter(iClassCoverage -> className.equals(iClassCoverage.getName())) .collect(Collectors.toList()); }
private void printNoMatchWarning(final Collection<IClassCoverage> nomatch, final PrintWriter out) { if (!nomatch.isEmpty()) { out.println( "[WARN] Some classes do not match with execution data."); out.println( "[WARN] For report generation the same class files must be used as at runtime."); for (final IClassCoverage c : nomatch) { out.printf( "[WARN] Execution data for class %s does not match.%n", c.getName()); } } }
@Override protected String getFileName() { final String vmname = getNode().getName(); final int pos = vmname.lastIndexOf('/'); final String shortname = pos == -1 ? vmname : vmname.substring(pos + 1); return shortname + ".html"; }
AnalyzedNodes(final Collection<IClassCoverage> classes, final Collection<ISourceFileCoverage> sourcefiles) { this.classmap = new HashMap<String, IClassCoverage>(); for (final IClassCoverage c : classes) { classmap.put(c.getName(), c); } this.sourcemap = new HashMap<String, ISourceFileCoverage>(); for (final ISourceFileCoverage s : sourcefiles) { final String key = sourceKey(s.getPackageName(), s.getName()); sourcemap.put(key, s); } }
public void visitCoverage(final IClassCoverage coverage) { final String desc = String.format("class 0x%016x %s", Long.valueOf(coverage.getId()), coverage.getName()); printDetails(desc, coverage); if (verbose) { for (final Iterator<IMethodCoverage> i = coverage.getMethods() .iterator(); i.hasNext();) { printMethod(i.next(), i.hasNext()); } } }
private static void logNoMatchClasses(Collection<IClassCoverage> noMatchClasses) { if (noMatchClasses.isEmpty()) { return; } LOG.warn("The following class(es) did not match with execution data:"); for (IClassCoverage iClassCoverage : noMatchClasses) { LOG.warn(String.format("> '%s'", iClassCoverage.getName())); } LOG.warn("In order to have accurate coverage measures, the same class files must be used as at runtime for report generation."); }
private void check(final IClassCoverage classCoverage) { final String name = names .getQualifiedClassName(classCoverage.getName()); checkRules(classCoverage, classRules, "class", name); if (traverseMethods) { for (final IMethodCoverage m : classCoverage.getMethods()) { check(m, classCoverage.getName()); } } }
final List<Integer> listOfCountForCounterFunction = CoverageImpl.getListOfCountForCounterFunction(coverage, ICounter::getCoveredCount); builderExecutionPath.append(coverage.getName()) .append(":") .append(listOfCountForCounterFunction
final IClassCoverage current = classCoverages.get(0); final List<IClassCoverage> subListOnSameClass = getSameClassCoverage(current.getName(), classCoverages); final List<List<Integer>> coveragePerMethods = subListOnSameClass.stream() .map(coverage ->
/** * Creates a 'class' element. * * @param coverage * class coverage node to write out * @return 'class' element * @throws IOException * in case of problems with the underlying output */ public ReportElement classElement(final IClassCoverage coverage) throws IOException { final ReportElement element = namedElement("class", coverage.getName()); element.attr("sourcefilename", coverage.getSourceFileName()); return element; }
public void visitCoverage(final IClassCoverage coverage) { final String name = coverage.getName(); final IClassCoverage dup = classes.put(name, coverage); if (dup != null) { if (dup.getId() != coverage.getId()) { throw new IllegalStateException( "Can't add different class with same name: " + name); } } else { final String source = coverage.getSourceFileName(); if (source != null) { final SourceFileCoverageImpl sourceFile = getSourceFile(source, coverage.getPackageName()); sourceFile.increment(coverage); } } }
@Override public String getLinkLabel() { return context.getLanguageNames().getClassName(getNode().getName(), getNode().getSignature(), getNode().getSuperName(), getNode().getInterfaceNames()); }
System.out.printf("Coverage of class %s%n", cc.getName()); printCounter("instructions", cc.getInstructionCounter()); printCounter("branches", cc.getBranchCounter());
@Override public void render() throws IOException { for (final IMethodCoverage m : getNode().getMethods()) { final String label = context.getLanguageNames().getMethodName( getNode().getName(), m.getName(), m.getDesc(), m.getSignature()); addItem(new MethodItem(m, label, sourcePage)); } super.render(); }
for (IClassCoverage classCov: classList) { ClassReport classReport = new ClassReport(); classReport.setName(classCov.getName()); classReport.setParent(packageReport); classReport.setSrcFileInfo(classCov, executionFileLoader.getSrcDir() + "/" + packageCov.getName() + "/" + classCov.getSourceFileName());
/** * 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(); }