/** * Returns the class in which this mutation is located * * @return class in which mutation is located */ public ClassName getClassName() { return this.location.getClassName(); }
public boolean isFor(final ClassName clazz) { return this.location.getClassName().equals(clazz); }
private Set<Integer> getLinesForBlock(BlockLocation bl) { Set<Integer> lines = this.blocksToLines.get(bl); if (lines == null) { calculateLinesForBlocks(bl.getLocation().getClassName()); lines = this.blocksToLines.get(bl); if (lines == null) { lines = Collections.emptySet(); } } return lines; }
@Override public int compareTo(final Location o) { int comp = this.clazz.compareTo(o.getClassName()); if (comp != 0) { return comp; } comp = this.method.name().compareTo(o.getMethodName().name()); if (comp != 0) { return comp; } return this.methodDesc.compareTo(o.getMethodDesc()); }
private Function<String, TestInfo> toTestInfo(final BlockCoverage blockData) { return a -> new TestInfo(null, a, 0, Optional.ofNullable(blockData.getBlock().getLocation().getClassName()), blockData.getBlock().getBlock()); }
/** * Returns the class in which this mutation is located * * @return class in which mutation is located */ public ClassName getClassName() { return this.location.getClassName(); }
@Test public void shouldIncludeAllCoveredLinesInCoverageSummary() { final BlockLocationBuilder block = aBlockLocation(); when(this.code.getCodeUnderTestNames()).thenReturn( Collections.singleton(block.build().getLocation().getClassName())); when(this.lm.mapLines(any(ClassName.class))).thenReturn( makeCoverageMapForBlock(block, 1, 2, 3, 4)); final CoverageResultBuilder cr = aCoverageResult().withVisitedBlocks( block.build(1)); this.testee.calculateClassCoverage(cr.build()); final CoverageSummary actual = this.testee.createSummary(); assertEquals(4, actual.getNumberOfCoveredLines()); }
private void writeLineCoverage(final BlockCoverage each, final Writer out) { final Location l = each.getBlock().getLocation(); write( out, "<block classname='" + l.getClassName().asJavaName() + "'" + " method='" + StringUtil.escapeBasicHtmlChars(l.getMethodName().name()) + StringUtil.escapeBasicHtmlChars(l.getMethodDesc()) + "' number='" + each.getBlock().getBlock() + "'>"); write(out, "<tests>\n"); final List<String> ts = new ArrayList<>(each.getTests()); Collections.sort(ts); for (final String test : ts) { write(out, "<test name='" + StringUtil.escapeBasicHtmlChars(test) + "'/>\n"); } write(out, "</tests>\n"); write(out, "</block>\n"); }
public boolean isFor(final ClassName clazz) { return this.location.getClassName().equals(clazz); }
public String className() { return location.getClassName().getNameWithoutPackage().asInternalName(); }
private String getFilePath(MethodRecord method) { return Paths.get(method.getLocation().getClassName().asJavaName(), method.declaration() + ".html").toString(); }
public String packageName() { return location.getClassName().getPackage().asInternalName(); }
@Override public int compareTo(final Location o) { int comp = this.clazz.compareTo(o.getClassName()); if (comp != 0) { return comp; } comp = this.method.name().compareTo(o.getMethodName().name()); if (comp != 0) { return comp; } return this.methodDesc.compareTo(o.getMethodDesc()); }