Search in sources :

Example 1 with PathAwareCrawler

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)));
}
Also used : PathAwareCrawler(org.sonar.ce.task.projectanalysis.component.PathAwareCrawler) ReportComponent(org.sonar.ce.task.projectanalysis.component.ReportComponent) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 PathAwareCrawler (org.sonar.ce.task.projectanalysis.component.PathAwareCrawler)1 ReportComponent (org.sonar.ce.task.projectanalysis.component.ReportComponent)1