use of org.sonar.ce.task.step.ComputationStep in project sonarqube by SonarSource.
the class LoadMeasureComputersStepTest method fail_with_ISE_when_two_measure_computers_generate_the_same_output_metric.
@Test
public void fail_with_ISE_when_two_measure_computers_generate_the_same_output_metric() {
assertThatThrownBy(() -> {
MeasureComputer[] computers = new MeasureComputer[] { newMeasureComputer(array(NCLOC_KEY), array(NEW_METRIC_1)), newMeasureComputer(array(CLASSES_KEY), array(NEW_METRIC_1)) };
ComputationStep underTest = new LoadMeasureComputersStep(holder, array(new TestMetrics()), computers);
underTest.execute(new TestComputationStepContext());
}).isInstanceOf(IllegalStateException.class).hasMessage("Output metric 'metric1' is already defined by another measure computer 'TestMeasureComputer'");
}
use of org.sonar.ce.task.step.ComputationStep in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStepTest method execute_fails_with_MessageException_if_projectKey_is_null_in_CE_task.
@Test
public void execute_fails_with_MessageException_if_projectKey_is_null_in_CE_task() {
CeTask res = mock(CeTask.class);
Optional<CeTask.Component> component = Optional.of(new CeTask.Component("prj_uuid", null, null));
when(res.getComponent()).thenReturn(component);
when(res.getMainComponent()).thenReturn(Optional.of(new CeTask.Component("main_prj_uuid", "main_prj_key", null)));
reportReader.setMetadata(ScannerReport.Metadata.newBuilder().build());
ComputationStep underTest = createStep(res);
assertThatThrownBy(() -> underTest.execute(new TestComputationStepContext())).isInstanceOf(MessageException.class).hasMessage("Compute Engine task component key is null. Project with UUID prj_uuid must have been deleted since report was uploaded. Can not proceed.");
}
Aggregations