Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Update to JaCoCo 0.8.8
Browse files Browse the repository at this point in the history
Some coverage-counts changed due to changes in JaCoCo
  • Loading branch information
centic9 committed May 9, 2022
1 parent 556c825 commit d6997be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ THE SOFTWARE.

<properties>
<java.level>8</java.level>
<jacoco.version>0.8.7</jacoco.version>
<jacoco.version>0.8.8</jacoco.version>
<!-- see https://www.jenkins.io/changelog-stable/ for changelog of the LTS releases -->
<jenkins.version>2.277.1</jenkins.version>
<!-- until the plugin-pom picks up a newer version -->
Expand Down
16 changes: 8 additions & 8 deletions src/test/java/hudson/plugins/jacoco/e2e/E2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ public void simpleTest() throws Throwable {
FreeStyleProject project = r.createFreeStyleProject();
project.getBuildersList().addAll(createJacocoProjectBuilders());
project.getPublishersList().add(new JacocoPublisher());

FreeStyleBuild build = r.buildAndAssertSuccess(project);

assertThat("plugin collected data", build.getLog(), containsString("Collecting JaCoCo coverage data"));

JacocoBuildAction action = build.getAction(JacocoBuildAction.class);
assertThat("Build has the Jacoco Action", action, notNullValue());
assertThat("incorrect branch coverage reported", action.getBranchCoverage(), withCoverage(0, 621, 621));

assertThat("incorrect branch coverage reported", action.getBranchCoverage(), withCoverage(0, 617, 617));
assertThat("incorrect class coverage reported", action.getClassCoverage(), withCoverage(7, 59, 66));
assertThat("incorrect complexity coverage reported", action.getComplexityScore(), withCoverage(19, 835, 854));
assertThat("incorrect complexity coverage reported", action.getComplexityScore(), withCoverage(19, 833, 852));
// different compilers can generate different instructions (e.g. java8 vs java 11.
// so just skip this for now as it seems brittle
// assertThat("incorrect instruction coverage reported", action.getInstructionCoverage(), withCoverage(229, 9013, 9242)); /* java 8* /
Expand All @@ -73,7 +73,7 @@ private static List<Builder> createJacocoProjectBuilders() {
}
return builders;
}

public static class CoverageMatcher extends TypeSafeDiagnosingMatcher<Coverage> {

private final int covered;
Expand All @@ -90,7 +90,7 @@ public void describeTo(Description description) {
description.appendText(" with covered="+ covered);
description.appendText(" and missed="+ missed);
description.appendText(" and total="+ total);

}

@Override
Expand All @@ -99,11 +99,11 @@ protected boolean matchesSafely(Coverage coverage, Description mismatchDescripti
mismatchDescription.appendText(" and missed="+ coverage.getMissed());
mismatchDescription.appendText(" and total="+ coverage.getTotal());

return coverage.getCovered() == covered &&
return coverage.getCovered() == covered &&
coverage.getMissed() == missed &&
coverage.getTotal() == total;
}

public static CoverageMatcher withCoverage(int covered, int missed, int total) {
return new CoverageMatcher(covered, missed, total);
}
Expand Down

0 comments on commit d6997be

Please # to comment.