use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class QualityGateMeasuresStepTest method mutableQualityGateStatusHolder_is_not_populated_if_there_is_no_qualitygate.
@Test
public void mutableQualityGateStatusHolder_is_not_populated_if_there_is_no_qualitygate() {
qualityGateHolder.setQualityGate(null);
underTest.execute(new TestComputationStepContext());
assertThatThrownBy(() -> qualityGateStatusHolder.getStatus()).isInstanceOf(IllegalStateException.class).hasMessage("Quality gate status has not been set yet");
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class QualityGateMeasuresStepTest method no_measure_if_tree_has_no_project.
@Test
public void no_measure_if_tree_has_no_project() {
ReportComponent notAProjectComponent = ReportComponent.builder(Component.Type.DIRECTORY, 1).build();
treeRootHolder.setRoot(notAProjectComponent);
underTest.execute(new TestComputationStepContext());
measureRepository.getAddedRawMeasures(1).isEmpty();
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class RegisterQualityProfileStatusStepTest method register_nothing_if_no_base_measure.
@Test
public void register_nothing_if_no_base_measure() {
when(measureRepository.getBaseMeasure(treeRootHolder.getRoot(), qualityProfileMetric)).thenReturn(Optional.empty());
underTest.execute(new TestComputationStepContext());
verifyNoMoreInteractions(qProfileStatusRepository);
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class RegisterQualityProfileStatusStepTest method register_added_profile.
@Test
public void register_added_profile() {
QualityProfile qp1 = qp(QP_NAME_1, LANGUAGE_KEY_1, new Date(1000L));
QualityProfile qp2 = qp(QP_NAME_2, LANGUAGE_KEY_2, new Date(1000L));
mockBaseQPMeasures(treeRootHolder.getRoot(), arrayOf(qp1));
mockRawQProfiles(ImmutableList.of(qp1, qp2));
underTest.execute(new TestComputationStepContext());
verify(qProfileStatusRepository).register(qp1.getQpKey(), UNCHANGED);
verify(qProfileStatusRepository).register(qp2.getQpKey(), ADDED);
verifyNoMoreInteractions(qProfileStatusRepository);
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class RegisterQualityProfileStatusStepTest method register_removed_profile.
@Test
public void register_removed_profile() {
QualityProfile qp = qp(QP_NAME_1, LANGUAGE_KEY_1, new Date());
mockBaseQPMeasures(treeRootHolder.getRoot(), new QualityProfile[] { qp });
underTest.execute(new TestComputationStepContext());
verify(qProfileStatusRepository).register(qp.getQpKey(), REMOVED);
verifyNoMoreInteractions(qProfileStatusRepository);
}
Aggregations