Skip to content

Commit

Permalink
Add an assertion for the table column model of each parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Jan 18, 2024
1 parent bc2e431 commit b349251
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.jenkins.plugins.coverage.metrics.AbstractCoverageITest;
import io.jenkins.plugins.coverage.metrics.model.Baseline;
import io.jenkins.plugins.coverage.metrics.steps.CoverageTool.Parser;
import io.jenkins.plugins.datatables.TableModel;

import static io.jenkins.plugins.coverage.metrics.AbstractCoverageTest.*;
import static org.assertj.core.api.Assertions.*;
Expand Down Expand Up @@ -159,6 +160,21 @@ private static void verifyJaCoCoAction(final CoverageBuildAction coverageResult)
.withCovered(JACOCO_ANALYSIS_MODEL_COVERED)
.withMissed(JACOCO_ANALYSIS_MODEL_TOTAL - JACOCO_ANALYSIS_MODEL_COVERED)
.build());
assertThat(coverageResult.getTarget().getTableModel(CoverageViewModel.ABSOLUTE_COVERAGE_TABLE_ID))
.extracting(TableModel::getColumns).asList()
.extracting("headerLabel")
.containsExactly("Hash",
"Modified",
"File",
"Package",
"Line",
"Line Δ",
"Branch",
"Branch Δ",
"LOC",
"Complexity",
"Max. Complexity",
"Complexity / LOC");
}

@Test
Expand Down Expand Up @@ -376,6 +392,20 @@ private void verifyOnePitResult(final ParameterizedJob<?, ?> project) {
assertThat(m.getCovered()).isEqualTo(222);
assertThat(m.getTotal()).isEqualTo(230);
});
assertThat(coverageResult.getTarget().getTableModel(CoverageViewModel.ABSOLUTE_COVERAGE_TABLE_ID))
.extracting(TableModel::getColumns).asList()
.extracting("headerLabel")
.containsExactly("Hash",
"Modified",
"File",
"Package",
"Line",
"Line Δ",
"Mutation",
"Mutation Δ",
"Test Strength",
"Test Strength Δ",
"LOC");
}

private static CoverageBuilder createLineCoverageBuilder() {
Expand Down

0 comments on commit b349251

Please sign in to comment.