private static final int FILE_3_REF = 12351;
private static final int UNIT_TEST_1_REF = 12352;
private static final int UNIT_TEST_2_REF = 12361;
- private static final Integer NO_FILE_METRIC = null;
+ private static final Integer NO_METRIC = null;
@Rule
public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule().setRoot(
verifyNoMeasure(UNIT_TEST_2_REF);
verifyMeasuresOnOtherComponent(DIRECTORY_1_REF, 2, 1);
verifyMeasuresOnOtherComponent(DIRECTORY_2_REF, 1, 1);
- verifyMeasuresOnOtherComponent(DIRECTORY_3_REF, NO_FILE_METRIC, 1);
+ verifyMeasuresOnOtherComponent(DIRECTORY_3_REF, NO_METRIC, NO_METRIC);
verifyMeasuresOnOtherComponent(SUB_MODULE_REF, 3, 3);
verifyMeasuresOnOtherComponent(MODULE_REF, 3, 3);
verifyMeasuresOnOtherComponent(ROOT_REF, 3, 3);
entryOf(metric1Key, newMeasureBuilder().create(7)),
entryOf(metric2Key, newMeasureBuilder().create(100))
};
- verifyMeasuresOnOtherComponent(DIRECTORY_3_REF, NO_FILE_METRIC, 1);
+ verifyMeasuresOnOtherComponent(DIRECTORY_3_REF, NO_METRIC, NO_METRIC);
verifyMeasuresOnOtherComponent(SUB_MODULE_REF, 3, 3, subModuleAndAboveEntries);
verifyMeasuresOnOtherComponent(MODULE_REF, 3, 3, subModuleAndAboveEntries);
verifyMeasuresOnOtherComponent(ROOT_REF, 3, 3, subModuleAndAboveEntries);
verifyNoMeasure(UNIT_TEST_2_REF);
verifyMeasuresOnOtherComponent(DIRECTORY_1_REF, 2, 1, entryOf(metricKey, newMeasureBuilder().create(16)));
verifyMeasuresOnOtherComponent(DIRECTORY_2_REF, 1, 1, entryOf(metricKey, newMeasureBuilder().create(3)));
- verifyMeasuresOnOtherComponent(DIRECTORY_3_REF, NO_FILE_METRIC, 1);
+ verifyMeasuresOnOtherComponent(DIRECTORY_3_REF, NO_METRIC, NO_METRIC);
verifyMeasuresOnOtherComponent(SUB_MODULE_REF, 3, 3, entryOf(metricKey, newMeasureBuilder().create(19)));
verifyMeasuresOnOtherComponent(MODULE_REF, 3, 3, entryOf(metricKey, newMeasureBuilder().create(19)));
verifyMeasuresOnOtherComponent(ROOT_REF, 3, 3, entryOf(metricKey, newMeasureBuilder().create(19)));
.containsOnly(entryOf(FILES_KEY, newMeasureBuilder().create(fileCount)));
}
- private void verifyMeasuresOnOtherComponent(int componentRef, @Nullable Integer fileCount, int directoryCount, MeasureRepoEntry... otherMeasures) {
+ private void verifyMeasuresOnOtherComponent(int componentRef, @Nullable Integer fileCount, @Nullable Integer directoryCount, MeasureRepoEntry... otherMeasures) {
MeasureRepoEntry[] measureRepoEntries = concatIntoArray(
otherMeasures,
- fileCount == null ? null : entryOf(FILES_KEY, newMeasureBuilder().create(fileCount)), entryOf(DIRECTORIES_KEY, newMeasureBuilder().create(directoryCount)));
+ fileCount == null ? null : entryOf(FILES_KEY, newMeasureBuilder().create(fileCount)),
+ directoryCount == null ? null : entryOf(DIRECTORIES_KEY, newMeasureBuilder().create(directoryCount))
+ );
assertThat(toEntries(measureRepository.getAddedRawMeasures(componentRef)))
.containsOnly(measureRepoEntries);
}
private static final int PROJECTVIEW_3_REF = 1241;
private static final int PROJECTVIEW_4_REF = 1251;
private static final int PROJECTVIEW_5_REF = 14;
- private static final Integer NO_FILE_METRIC = null;
+ private static final Integer NO_METRIC = null;
@Rule
public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule().setRoot(
verifyNoMeasure(PROJECTVIEW_5_REF);
verifyMeasures(SUB_SUBVIEW_1_REF, 3, 3);
verifyMeasures(SUB_SUBVIEW_2_REF, 3, 0);
- verifyMeasures(SUB_SUBVIEW_3_REF, NO_FILE_METRIC, 4);
+ verifyMeasures(SUB_SUBVIEW_3_REF, NO_METRIC, NO_METRIC);
verifyMeasures(SUBVIEW_1_REF, 6, 7);
- verifyMeasures(SUBVIEW_2_REF, NO_FILE_METRIC, 0);
+ verifyMeasures(SUBVIEW_2_REF, NO_METRIC, NO_METRIC);
verifyMeasures(ROOT_REF, 11, 12);
}
verifyMeasures(SUB_SUBVIEW_1_REF, 3, 3,
entryOf(metric1Key, newMeasureBuilder().create(7)), entryOf(metric2Key, newMeasureBuilder().create(10)));
verifyMeasures(SUB_SUBVIEW_2_REF, 3, 0);
- verifyMeasures(SUB_SUBVIEW_3_REF, NO_FILE_METRIC, 4,
+ verifyMeasures(SUB_SUBVIEW_3_REF, NO_METRIC, NO_METRIC,
entryOf(metric2Key, newMeasureBuilder().create(90)));
verifyMeasures(SUBVIEW_1_REF, 6, 7,
entryOf(metric1Key, newMeasureBuilder().create(7)), entryOf(metric2Key, newMeasureBuilder().create(100)));
- verifyMeasures(SUBVIEW_2_REF, NO_FILE_METRIC, 0);
+ verifyMeasures(SUBVIEW_2_REF, NO_METRIC, NO_METRIC);
verifyMeasures(ROOT_REF, 11, 12,
entryOf(metric1Key, newMeasureBuilder().create(10)), entryOf(metric2Key, newMeasureBuilder().create(107)));
}
verifyNoMeasure(PROJECTVIEW_5_REF);
verifyMeasures(SUB_SUBVIEW_1_REF, 3, 3, entryOf(metricKey, newMeasureBuilder().create(16)));
verifyMeasures(SUB_SUBVIEW_2_REF, 3, 0);
- verifyMeasures(SUB_SUBVIEW_3_REF, NO_FILE_METRIC, 4, entryOf(metricKey, newMeasureBuilder().create(3)));
+ verifyMeasures(SUB_SUBVIEW_3_REF, NO_METRIC, NO_METRIC, entryOf(metricKey, newMeasureBuilder().create(3)));
verifyMeasures(SUBVIEW_1_REF, 6, 7, entryOf(metricKey, newMeasureBuilder().create(19)));
- verifyMeasures(SUBVIEW_2_REF, NO_FILE_METRIC, 0);
+ verifyMeasures(SUBVIEW_2_REF, NO_METRIC, NO_METRIC);
verifyMeasures(ROOT_REF, 11, 12, entryOf(metricKey, newMeasureBuilder().create(26)));
}
verifyMetricAggregation(CLASSES_KEY);
}
- private void verifyMeasures(int componentRef, @Nullable Integer fileCount, int directoryCount, MeasureRepoEntry... otherMeasures) {
+ private void verifyMeasures(int componentRef, @Nullable Integer fileCount, @Nullable Integer directoryCount, MeasureRepoEntry... otherMeasures) {
assertThat(toEntries(measureRepository.getAddedRawMeasures(componentRef)))
.containsOnly(
concatIntoArray(otherMeasures, createFileAndDirectoryEntries(fileCount, directoryCount)));
}
- private static MeasureRepoEntry[] createFileAndDirectoryEntries(@Nullable Integer fileCount, int directoryCount) {
+ private static MeasureRepoEntry[] createFileAndDirectoryEntries(@Nullable Integer fileCount, @Nullable Integer directoryCount) {
return new MeasureRepoEntry[] {
fileCount == null ? null : entryOf(FILES_KEY, newMeasureBuilder().create(fileCount)),
- entryOf(DIRECTORIES_KEY, newMeasureBuilder().create(directoryCount))
+ directoryCount == null ? null : entryOf(DIRECTORIES_KEY, newMeasureBuilder().create(directoryCount))
};
}