Search in sources :

Example 6 with UseDataProvider

use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.

the class MeasureToMeasureDtoTest method toMeasureDto_returns_Dto_without_any_variation_if_Measure_has_no_MeasureVariations.

@Test
@UseDataProvider("all_types_Measures")
public void toMeasureDto_returns_Dto_without_any_variation_if_Measure_has_no_MeasureVariations(Measure measure, Metric metric) {
    MeasureDto measureDto = underTest.toMeasureDto(measure, metric, SOME_COMPONENT);
    assertThat(measureDto.getVariation()).isNull();
}
Also used : MeasureDto(org.sonar.db.measure.MeasureDto) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Example 7 with UseDataProvider

use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.

the class MeasureToMeasureDtoTest method toMeasureDto_set_componentId_and_snapshotId_from_method_arguments.

@Test
@UseDataProvider("all_types_Measures")
public void toMeasureDto_set_componentId_and_snapshotId_from_method_arguments(Measure measure, Metric metric) {
    MeasureDto measureDto = underTest.toMeasureDto(measure, metric, SOME_COMPONENT);
    assertThat(measureDto.getComponentUuid()).isEqualTo(SOME_COMPONENT.getUuid());
// assertThat(measureDto.getSnapshotId()).isEqualTo(SOME_SNAPSHOT_ID);
}
Also used : MeasureDto(org.sonar.db.measure.MeasureDto) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Example 8 with UseDataProvider

use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.

the class MeasureToMeasureDtoTest method toMeasureDto_returns_Dto_without_alertStatus_nor_alertText_if_Measure_has_no_QualityGateStatus.

@Test
@UseDataProvider("all_types_Measures")
public void toMeasureDto_returns_Dto_without_alertStatus_nor_alertText_if_Measure_has_no_QualityGateStatus(Measure measure, Metric metric) {
    MeasureDto measureDto = underTest.toMeasureDto(measure, metric, SOME_COMPONENT);
    assertThat(measureDto.getAlertStatus()).isNull();
    assertThat(measureDto.getAlertText()).isNull();
}
Also used : MeasureDto(org.sonar.db.measure.MeasureDto) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Example 9 with UseDataProvider

use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.

the class PurgeDatastoresStepTest method do_not_call_purge_method_of_the_purge_task_for_other_views_components.

@Test
@UseDataProvider("nonRootViewsComponentTypes")
public void do_not_call_purge_method_of_the_purge_task_for_other_views_components(Component.Type type) {
    Component component = ViewsComponent.builder(type, PROJECT_KEY).setUuid(PROJECT_UUID).build();
    verify_do_not_call_purge_method_of_the_purge_task(component);
}
Also used : ViewsComponent(org.sonar.server.computation.task.projectanalysis.component.ViewsComponent) Component(org.sonar.server.computation.task.projectanalysis.component.Component) ReportComponent(org.sonar.server.computation.task.projectanalysis.component.ReportComponent) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Example 10 with UseDataProvider

use of com.tngtech.java.junit.dataprovider.UseDataProvider in project sonarqube by SonarSource.

the class ServerLoggingTest method changeLevel_calls_changeRoot_with_LogLevelConfig_and_level_converted_to_logback_class_then_log_INFO_message.

@Test
@UseDataProvider("supportedSonarApiLevels")
public void changeLevel_calls_changeRoot_with_LogLevelConfig_and_level_converted_to_logback_class_then_log_INFO_message(LoggerLevel level) {
    ServerProcessLogging serverProcessLogging = mock(ServerProcessLogging.class);
    LogLevelConfig logLevelConfig = LogLevelConfig.newBuilder().build();
    when(serverProcessLogging.getLogLevelConfig()).thenReturn(logLevelConfig);
    underTest.changeLevel(serverProcessLogging, level);
    verify(logbackHelper).changeRoot(logLevelConfig, Level.valueOf(level.name()));
}
Also used : ServerProcessLogging(org.sonar.server.app.ServerProcessLogging) LogLevelConfig(org.sonar.process.logging.LogLevelConfig) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Aggregations

UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)32 Test (org.junit.Test)32 Period (org.sonar.server.computation.task.projectanalysis.period.Period)8 Component (org.sonar.server.computation.task.projectanalysis.component.Component)5 ReportComponent (org.sonar.server.computation.task.projectanalysis.component.ReportComponent)4 MeasureDto (org.sonar.db.measure.MeasureDto)3 PropertyTesting.newComponentPropertyDto (org.sonar.db.property.PropertyTesting.newComponentPropertyDto)3 PropertyTesting.newGlobalPropertyDto (org.sonar.db.property.PropertyTesting.newGlobalPropertyDto)3 PropertyTesting.newUserPropertyDto (org.sonar.db.property.PropertyTesting.newUserPropertyDto)3 Date (java.util.Date)2 InOrder (org.mockito.InOrder)2 PostProjectAnalysisTask (org.sonar.api.ce.posttask.PostProjectAnalysisTask)2 ComponentDto (org.sonar.db.component.ComponentDto)2 ViewsComponent (org.sonar.server.computation.task.projectanalysis.component.ViewsComponent)2 Metric (org.sonar.server.computation.task.projectanalysis.metric.Metric)2 MetricImpl (org.sonar.server.computation.task.projectanalysis.metric.MetricImpl)2 LoggerContext (ch.qos.logback.classic.LoggerContext)1 ErrorResponseBody (com.nike.riposte.server.error.handler.ErrorResponseBody)1 PipelineContinuationBehavior (com.nike.riposte.server.handler.base.PipelineContinuationBehavior)1 Endpoint (com.nike.riposte.server.http.Endpoint)1