use of org.sonar.ce.task.step.ComputationStep in project sonarqube by SonarSource.
the class LoadMeasureComputersStepTest method fail_with_ISE_when_output_metric_is_a_core_metric.
@Test
public void fail_with_ISE_when_output_metric_is_a_core_metric() {
assertThatThrownBy(() -> {
MeasureComputer[] computers = new MeasureComputer[] { newMeasureComputer(array(NEW_METRIC_4), array(NCLOC_KEY)) };
ComputationStep underTest = new LoadMeasureComputersStep(holder, array(new TestMetrics()), computers);
underTest.execute(new TestComputationStepContext());
}).isInstanceOf(IllegalStateException.class).hasMessage("Metric 'ncloc' cannot be used as an output metric because it's a core metric");
}
use of org.sonar.ce.task.step.ComputationStep in project sonarqube by SonarSource.
the class LoadMeasureComputersStepTest method return_empty_list_when_no_measure_computers.
@Test
public void return_empty_list_when_no_measure_computers() {
ComputationStep underTest = new LoadMeasureComputersStep(holder, array(new TestMetrics()));
underTest.execute(new TestComputationStepContext());
assertThat(holder.getMeasureComputers()).isEmpty();
}
use of org.sonar.ce.task.step.ComputationStep in project sonarqube by SonarSource.
the class LoadMeasureComputersStepTest method fail_with_ISE_when_no_metrics_are_defined_by_plugin_but_measure_computer_use_a_new_metric.
@Test
public void fail_with_ISE_when_no_metrics_are_defined_by_plugin_but_measure_computer_use_a_new_metric() {
assertThatThrownBy(() -> {
MeasureComputer[] computers = new MeasureComputer[] { newMeasureComputer(array(NCLOC_KEY), array(NEW_METRIC_1)) };
ComputationStep underTest = new LoadMeasureComputersStep(holder, computers);
underTest.execute(new TestComputationStepContext());
}).isInstanceOf(IllegalStateException.class).hasMessage("Metric 'metric1' cannot be used as an output metric because no plugins declare this metric");
}
use of org.sonar.ce.task.step.ComputationStep in project sonarqube by SonarSource.
the class LoadMeasureComputersStepTest method support_plugin_metrics_as_input_metrics.
@Test
public void support_plugin_metrics_as_input_metrics() {
MeasureComputer[] computers = new MeasureComputer[] { newMeasureComputer(array(NEW_METRIC_1), array(NEW_METRIC_2)) };
ComputationStep underTest = new LoadMeasureComputersStep(holder, array(new TestMetrics()), computers);
underTest.execute(new TestComputationStepContext());
assertThat(holder.getMeasureComputers()).hasSize(1);
}
use of org.sonar.ce.task.step.ComputationStep in project sonarqube by SonarSource.
the class LoadMeasureComputersStepTest method support_core_metrics_as_input_metrics.
@Test
public void support_core_metrics_as_input_metrics() {
MeasureComputer[] computers = new MeasureComputer[] { newMeasureComputer(array(NCLOC_KEY), array(NEW_METRIC_1)) };
ComputationStep underTest = new LoadMeasureComputersStep(holder, array(new TestMetrics()), computers);
underTest.execute(new TestComputationStepContext());
assertThat(holder.getMeasureComputers()).hasSize(1);
}
Aggregations