Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public Optional<Delta> calculateCodeDeltaToReference(final Run<?, ?> referenceBu
*/
public Set<FileChanges> getCoverageRelevantChanges(final Delta delta) {
return delta.getFileChangesMap().values().stream()
.filter(fileChange -> fileChange.getFileEditType().equals(FileEditType.MODIFY)
|| fileChange.getFileEditType().equals(FileEditType.ADD)
|| fileChange.getFileEditType().equals(FileEditType.RENAME))
.filter(fileChange -> fileChange.getFileEditType() == FileEditType.MODIFY
|| fileChange.getFileEditType() == FileEditType.ADD
|| fileChange.getFileEditType() == FileEditType.RENAME)
.collect(Collectors.toSet());
}

Expand Down Expand Up @@ -156,7 +156,7 @@ public Map<String, String> createOldPathMapping(final Node root, final Node refe
Set<String> oldReportPaths = new HashSet<>(referenceRoot.getFiles());
// mapping between reference and current file paths which initially contains the SCM paths with renamings
Map<String, String> oldPathMapping = changes.entrySet().stream()
.filter(entry -> FileEditType.RENAME.equals(entry.getValue().getFileEditType()))
.filter(entry -> FileEditType.RENAME == entry.getValue().getFileEditType())
.collect(Collectors.toMap(Entry::getKey, entry -> entry.getValue().getOldFileName()));
// the SCM paths and the coverage report paths from the reference
Map<String, String> oldScmToOldReportPathMapping
Expand Down Expand Up @@ -246,7 +246,8 @@ private void removeMissingReferences(final Map<String, String> oldPathMapping, f
.map(Entry::getKey)
.collect(Collectors.toSet());
if (!pathsWithEmptyReferences.isEmpty()) {
pathsWithEmptyReferences.forEach(oldPathMapping::remove); // remove entries which represent missing reference files
pathsWithEmptyReferences.forEach(
oldPathMapping::remove); // remove entries which represent missing reference files
var skippedFiles = pathsWithEmptyReferences.stream()
.limit(20) // prevent log overflows
.collect(Collectors.joining("," + System.lineSeparator()));
Expand Down Expand Up @@ -282,7 +283,8 @@ static void verifyOldPathMapping(final Map<String, String> oldPathMapping, final
.limit(20) // prevent log overflows
.map(entry -> "new: '%s' - former: '%s'".formatted(entry.getKey(), entry.getValue()))
.collect(Collectors.joining("," + System.lineSeparator()));
var errorMessage = CODE_DELTA_TO_COVERAGE_DATA_MISMATCH_ERROR_TEMPLATE + System.lineSeparator() + mismatches;
var errorMessage =
CODE_DELTA_TO_COVERAGE_DATA_MISMATCH_ERROR_TEMPLATE + System.lineSeparator() + mismatches;
throw new IllegalStateException(errorMessage);
}
log.logInfo("Successfully verified that the coverage data matches with the code delta");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ void shouldCreateColorProviderWithJenkinsColors() {

for (CoverageColorPalette color : CoverageColorPalette.values()) {
assertThat(colorProvider.containsColorId(color.getColorId())).isTrue();
if (!color.getColorId().equals(ColorId.BLACK) && !color.getColorId()
.equals(ColorId.WHITE)) { // skip set default color
if (color.getColorId() != ColorId.BLACK
&& color.getColorId() != ColorId.WHITE) { // skip set default color
assertThat(colorProvider.getDisplayColorsOf(color.getColorId()))
.satisfies(displayColor -> assertThat(displayColor.getFillColor()).isEqualTo(TEST_COLOR));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@ private void verifyModifiedLinesCoverage(final CoverageBuildAction action) {

private void verifyIndirectCoverageChanges(final CoverageBuildAction action) {
assertThat(action.getAllValues(Baseline.INDIRECT))
.filteredOn(coverage -> coverage.getMetric().equals(LINE))
.filteredOn(coverage -> coverage.getMetric() == LINE)
.first()
.isInstanceOfSatisfying(Coverage.class, coverage -> {
assertThat(coverage.getCovered()).isEqualTo(4);
assertThat(coverage.getMissed()).isEqualTo(0);
});
assertThat(action.getAllValues(Baseline.INDIRECT))
.filteredOn(coverage -> coverage.getMetric().equals(BRANCH))
.filteredOn(coverage -> coverage.getMetric() == BRANCH)
.isEmpty();
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>analysis-pom</artifactId>
<version>11.2934.va_a_d795c46a_7b_</version>
<version>11.2958.v63511c4c1160</version>
<relativePath/>
</parent>

Expand Down
Loading