Search in sources :

Example 1 with ScannerMetrics

use of org.sonar.core.metric.ScannerMetrics in project sonarqube by SonarSource.

the class DefaultSensorStorageTest method prepare.

@Before
public void prepare() throws Exception {
    MetricFinder metricFinder = mock(MetricFinder.class);
    when(metricFinder.<Integer>findByKey(CoreMetrics.NCLOC_KEY)).thenReturn(CoreMetrics.NCLOC);
    when(metricFinder.<String>findByKey(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION_KEY)).thenReturn(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION);
    settings = new MapSettings();
    moduleIssues = mock(ModuleIssues.class);
    measureCache = mock(MeasureCache.class);
    CoverageExclusions coverageExclusions = mock(CoverageExclusions.class);
    when(coverageExclusions.isExcluded(any(InputFile.class))).thenReturn(false);
    ReportPublisher reportPublisher = mock(ReportPublisher.class);
    when(reportPublisher.getWriter()).thenReturn(new ScannerReportWriter(temp.newFolder()));
    underTest = new DefaultSensorStorage(metricFinder, moduleIssues, settings, coverageExclusions, reportPublisher, measureCache, mock(SonarCpdBlockIndex.class), contextPropertiesCache, new ScannerMetrics());
}
Also used : ReportPublisher(org.sonar.scanner.report.ReportPublisher) MapSettings(org.sonar.api.config.MapSettings) MeasureCache(org.sonar.scanner.scan.measure.MeasureCache) ModuleIssues(org.sonar.scanner.issue.ModuleIssues) MetricFinder(org.sonar.api.batch.measure.MetricFinder) ScannerMetrics(org.sonar.core.metric.ScannerMetrics) CoverageExclusions(org.sonar.scanner.sensor.coverage.CoverageExclusions) ScannerReportWriter(org.sonar.scanner.protocol.output.ScannerReportWriter) InputFile(org.sonar.api.batch.fs.InputFile) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 InputFile (org.sonar.api.batch.fs.InputFile)1 MetricFinder (org.sonar.api.batch.measure.MetricFinder)1 MapSettings (org.sonar.api.config.MapSettings)1 ScannerMetrics (org.sonar.core.metric.ScannerMetrics)1 ModuleIssues (org.sonar.scanner.issue.ModuleIssues)1 ScannerReportWriter (org.sonar.scanner.protocol.output.ScannerReportWriter)1 ReportPublisher (org.sonar.scanner.report.ReportPublisher)1 MeasureCache (org.sonar.scanner.scan.measure.MeasureCache)1 CoverageExclusions (org.sonar.scanner.sensor.coverage.CoverageExclusions)1