Skip to content

Commit

Permalink
A branch coverage of 0/n should be named "No branches covered".
Browse files Browse the repository at this point in the history
Before that change, it was called "partially covered".
  • Loading branch information
uhafner committed May 27, 2023
1 parent 353bb57 commit 72cd8a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public String getTooltip(final int line) {
if (missed == 0) {
return "All branches covered";
}
if (covered == 0) {
return "No branches covered";
}
return String.format("Partially covered, branch coverage: %d/%d", covered, covered + missed);
}
else if (covered == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ void shouldRenderLinesWithVariousCoverages() {
assertThat(anotherFile.getTooltip(43)).isEqualTo("All branches covered");
}

@Test
void shouldRenderNoBrnachCoverage() {
var tree = readResult("../steps/jacoco-analysis-model.xml", new JacocoParser());

var file = new CoverageSourcePrinter(tree.findFile("LineRangeList.java").get());

assertThat(file.getSummaryColumn(265)).isEqualTo("0/2");
assertThat(file.getTooltip(265)).isEqualTo("No branches covered");
assertThat(file.getColorClass(265)).isEqualTo(CoverageSourcePrinter.NO_COVERAGE);
}

@Test
void shouldRenderWholeLine() {
var tree = readResult("../steps/jacoco-codingstyle.xml", new JacocoParser());
Expand Down

0 comments on commit 72cd8a9

Please sign in to comment.