use of org.sonar.api.ce.measure.MeasureComputer 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.api.ce.measure.MeasureComputer 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.api.ce.measure.MeasureComputer 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);
}
Aggregations