private void verify_lines_and_conditions_aggregates_values( LinesAndConditionsWithUncoveredMetricKeys metricKeys) { measureRepository .addRawMeasure(FILE_1_REF, metricKeys.getLines(), newMeasureBuilder().create(3000)) .addRawMeasure(FILE_1_REF, metricKeys.getConditions(), newMeasureBuilder().create(300)) .addRawMeasure(FILE_1_REF, metricKeys.getUncoveredLines(), newMeasureBuilder().create(30)) .addRawMeasure( FILE_1_REF, metricKeys.getUncoveredConditions(), newMeasureBuilder().create(9)) .addRawMeasure(FILE_2_REF, metricKeys.getLines(), newMeasureBuilder().create(2000)) .addRawMeasure(FILE_2_REF, metricKeys.getConditions(), newMeasureBuilder().create(400)) .addRawMeasure(FILE_2_REF, metricKeys.getUncoveredLines(), newMeasureBuilder().create(200)) .addRawMeasure( FILE_2_REF, metricKeys.getUncoveredConditions(), newMeasureBuilder().create(16)); underTest.execute(); MeasureRepoEntry[] nonFileRepoEntries = { entryOf(metricKeys.getLines(), newMeasureBuilder().create(5000)), entryOf(metricKeys.getConditions(), newMeasureBuilder().create(700)), entryOf(metricKeys.getUncoveredLines(), newMeasureBuilder().create(230)), entryOf(metricKeys.getUncoveredConditions(), newMeasureBuilder().create(25)) }; assertThat(toEntries(measureRepository.getAddedRawMeasures(DIRECTORY_REF))) .contains(nonFileRepoEntries); assertThat(toEntries(measureRepository.getAddedRawMeasures(SUB_MODULE_REF))) .contains(nonFileRepoEntries); assertThat(toEntries(measureRepository.getAddedRawMeasures(MODULE_REF))) .contains(nonFileRepoEntries); assertThat(toEntries(measureRepository.getAddedRawMeasures(ROOT_REF))) .contains(nonFileRepoEntries); }
private void verify_coverage_aggregates_values( LinesAndConditionsWithUncoveredMetricKeys metricKeys, String codeCoverageKey, String lineCoverageKey, String branchCoverageKey) { measureRepository .addRawMeasure(FILE_1_REF, metricKeys.getLines(), newMeasureBuilder().create(3000)) .addRawMeasure(FILE_1_REF, metricKeys.getConditions(), newMeasureBuilder().create(300)) .addRawMeasure(FILE_1_REF, metricKeys.getUncoveredLines(), newMeasureBuilder().create(30)) .addRawMeasure( FILE_1_REF, metricKeys.getUncoveredConditions(), newMeasureBuilder().create(9)) .addRawMeasure(FILE_2_REF, metricKeys.getLines(), newMeasureBuilder().create(2000)) .addRawMeasure(FILE_2_REF, metricKeys.getConditions(), newMeasureBuilder().create(400)) .addRawMeasure(FILE_2_REF, metricKeys.getUncoveredLines(), newMeasureBuilder().create(200)) .addRawMeasure( FILE_2_REF, metricKeys.getUncoveredConditions(), newMeasureBuilder().create(16)); underTest.execute(); assertThat(toEntries(measureRepository.getAddedRawMeasures(FILE_1_REF))) .contains( entryOf(codeCoverageKey, newMeasureBuilder().create(98.8d, 1)), entryOf(lineCoverageKey, newMeasureBuilder().create(99d, 1)), entryOf(branchCoverageKey, newMeasureBuilder().create(97d, 1))); assertThat(toEntries(measureRepository.getAddedRawMeasures(FILE_2_REF))) .contains( entryOf(codeCoverageKey, newMeasureBuilder().create(91d, 1)), entryOf(lineCoverageKey, newMeasureBuilder().create(90d, 1)), entryOf(branchCoverageKey, newMeasureBuilder().create(96d, 1))); assertThat(toEntries(measureRepository.getAddedRawMeasures(UNIT_TEST_FILE_REF))).isEmpty(); MeasureRepoEntry[] nonFileRepoEntries = { entryOf(codeCoverageKey, newMeasureBuilder().create(95.5d, 1)), entryOf(lineCoverageKey, newMeasureBuilder().create(95.4d, 1)), entryOf(branchCoverageKey, newMeasureBuilder().create(96.4d, 1)) }; assertThat(toEntries(measureRepository.getAddedRawMeasures(DIRECTORY_REF))) .contains(nonFileRepoEntries); assertThat(toEntries(measureRepository.getAddedRawMeasures(SUB_MODULE_REF))) .contains(nonFileRepoEntries); assertThat(toEntries(measureRepository.getAddedRawMeasures(MODULE_REF))) .contains(nonFileRepoEntries); assertThat(toEntries(measureRepository.getAddedRawMeasures(ROOT_REF))) .contains(nonFileRepoEntries); }