use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.
the class PostProjectAnalysisTasksExecutorTest method finished_calls_all_PostProjectAnalysisTask_in_order_of_the_array_and_passes_the_same_object_to_all.
@Test
@UseDataProvider("booleanValues")
public void finished_calls_all_PostProjectAnalysisTask_in_order_of_the_array_and_passes_the_same_object_to_all(boolean allStepsExecuted) {
PostProjectAnalysisTask postProjectAnalysisTask1 = mock(PostProjectAnalysisTask.class);
PostProjectAnalysisTask postProjectAnalysisTask2 = mock(PostProjectAnalysisTask.class);
InOrder inOrder = inOrder(postProjectAnalysisTask1, postProjectAnalysisTask2);
new PostProjectAnalysisTasksExecutor(ceTask, analysisMetadataHolder, qualityGateHolder, qualityGateStatusHolder, reportReader, system2, new PostProjectAnalysisTask[] { postProjectAnalysisTask1, postProjectAnalysisTask2 }).finished(allStepsExecuted);
inOrder.verify(postProjectAnalysisTask1).finished(projectAnalysisArgumentCaptor.capture());
inOrder.verify(postProjectAnalysisTask2).finished(projectAnalysisArgumentCaptor.capture());
inOrder.verifyNoMoreInteractions();
List<PostProjectAnalysisTask.ProjectAnalysis> allValues = projectAnalysisArgumentCaptor.getAllValues();
assertThat(allValues).hasSize(2);
assertThat(allValues.get(0)).isSameAs(allValues.get(1));
}
use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.
the class DuplicationRepositoryImplTest method getDuplications_throws_IAE_if_Component_type_is_not_FILE.
@Test
@UseDataProvider("allComponentTypesButFile")
public void getDuplications_throws_IAE_if_Component_type_is_not_FILE(Component.Type type) {
expectFileTypeIAE();
Component component = mockComponentGetType(type);
underTest.getDuplications(component);
}
use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.
the class MapBasedRawMeasureRepositoryTest method update_throws_IAE_if_valueType_of_Measure_is_not_the_same_as_the_Metric_valueType_unless_NO_VALUE.
@Test
@UseDataProvider("measures")
public void update_throws_IAE_if_valueType_of_Measure_is_not_the_same_as_the_Metric_valueType_unless_NO_VALUE(Measure measure) {
for (Metric.MetricType metricType : Metric.MetricType.values()) {
if (metricType.getValueType() == measure.getValueType() || measure.getValueType() == Measure.ValueType.NO_VALUE) {
continue;
}
try {
final MetricImpl metric = new MetricImpl(1, "key" + metricType, "name" + metricType, metricType);
underTest.add(FILE_COMPONENT, metric, getSomeMeasureByValueType(metricType));
underTest.update(FILE_COMPONENT, metric, measure);
fail("An IllegalArgumentException should have been raised");
} catch (IllegalArgumentException e) {
assertThat(e).hasMessage(format("Measure's ValueType (%s) is not consistent with the Metric's ValueType (%s)", measure.getValueType(), metricType.getValueType()));
}
}
}
use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.
the class ScmInfoRepositoryImplTest method do_not_query_db_nor_report_if_component_type_is_not_FILE.
@Test
@UseDataProvider("allTypeComponentButFile")
public void do_not_query_db_nor_report_if_component_type_is_not_FILE(Component component) {
BatchReportReader batchReportReader = mock(BatchReportReader.class);
AnalysisMetadataHolder analysisMetadataHolder = mock(AnalysisMetadataHolder.class);
DbClient dbClient = mock(DbClient.class);
SourceHashRepository sourceHashRepository = mock(SourceHashRepository.class);
ScmInfoRepositoryImpl underTest = new ScmInfoRepositoryImpl(batchReportReader, analysisMetadataHolder, dbClient, sourceHashRepository);
assertThat(underTest.getScmInfo(component)).isAbsent();
verifyNoMoreInteractions(batchReportReader, analysisMetadataHolder, dbClient, sourceHashRepository);
}
use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.
the class BuildComponentTreeStepTest method verify_ref_and_type.
@Test
@UseDataProvider("allComponentTypes")
public void verify_ref_and_type(ComponentType componentType) {
int componentRef = 1;
reportReader.putComponent(component(componentRef, componentType));
underTest.execute();
Component root = treeRootHolder.getRoot();
assertThat(root).isNotNull();
assertThat(root.getType()).isEqualTo(Component.Type.valueOf(componentType.name()));
assertThat(root.getReportAttributes().getRef()).isEqualTo(ROOT_REF);
assertThat(root.getChildren()).isEmpty();
}
Aggregations