use of org.sonar.ce.task.projectanalysis.component.PathAwareCrawler in project sonarqube by SonarSource.
the class ReportFormulaExecutorComponentVisitorTest method fail_on_project_without_children_already_having_computed_measure.
@Test
public void fail_on_project_without_children_already_having_computed_measure() {
ReportComponent root = builder(PROJECT, ROOT_REF).build();
treeRootHolder.setRoot(root);
measureRepository.addRawMeasure(ROOT_REF, NCLOC_KEY, newMeasureBuilder().create(10));
// expectedException.expectCause(hasType(UnsupportedOperationException.class)
// .andMessage(String.format("A measure can only be set once for Component (ref=%s), Metric (key=%s)", ROOT_REF, NCLOC_KEY)));
assertThatThrownBy(() -> {
new PathAwareCrawler<>(formulaExecutorComponentVisitor(new FakeFormula())).visit(root);
}).hasCause(new UnsupportedOperationException(String.format("A measure can only be set once for Component (ref=%s), Metric (key=%s)", ROOT_REF, NCLOC_KEY)));
}
Aggregations