use of org.sonar.server.setting.TestProjectConfigurationLoader in project sonarqube by SonarSource.
the class LiveMeasureComputerImplTest method run.
private List<QGChangeEvent> run(Collection<ComponentDto> components, IssueMetricFormula... formulas) {
IssueMetricFormulaFactory formulaFactory = new TestIssueMetricFormulaFactory(asList(formulas));
when(qGateComputer.loadQualityGate(any(DbSession.class), any(ProjectDto.class), any(BranchDto.class))).thenReturn(qualityGate);
when(qGateComputer.getMetricsRelatedTo(qualityGate)).thenReturn(singleton(CoreMetrics.ALERT_STATUS_KEY));
when(qGateComputer.refreshGateStatus(eq(project), same(qualityGate), any(MeasureMatrix.class), any(Configuration.class))).thenReturn(newQualityGate);
MapSettings settings = new MapSettings(new PropertyDefinitions(System2.INSTANCE, CorePropertyDefinitions.all()));
ProjectConfigurationLoader configurationLoader = new TestProjectConfigurationLoader(settings.asConfig());
LiveMeasureComputerImpl underTest = new LiveMeasureComputerImpl(db.getDbClient(), formulaFactory, qGateComputer, configurationLoader, projectIndexer);
return underTest.refresh(db.getSession(), components);
}
Aggregations