@Override
  public void execute(SensorContext context) {
    Set<String> reportPaths = loadReportPaths();
    Map<String, SarifImportResults> filePathToImportResults = new HashMap<>();

    for (String reportPath : reportPaths) {
      try {
        SarifImportResults sarifImportResults = processReport(context, reportPath);
        filePathToImportResults.put(reportPath, sarifImportResults);
      } catch (NoSuchFileException e) {
        throw MessageException.of(format("SARIF report file not found: %s", e.getFile()));
      } catch (Exception exception) {
        LOG.warn("Failed to process SARIF report from file '{}', error: '{}'", reportPath, exception.getMessage());
      }
    }
    filePathToImportResults.forEach(SarifIssuesImportSensor::displayResults);
  }
@Test
  public void execute_whenImportFails_shouldSkipReport() throws NoSuchFileException {
    sensorSettings.setProperty("sonar.sarifReportPaths", SARIF_REPORT_PATHS_PARAM);

    ReportAndResults reportAndResults1 = mockFailedReportAndResults(FILE_1);
    ReportAndResults reportAndResults2 = mockSuccessfulReportAndResults(FILE_2);

    doThrow(new NullPointerException("import failed")).when(sarifImporter).importSarif(reportAndResults1.getSarifReport());

    SarifIssuesImportSensor sensor = new SarifIssuesImportSensor(sarifSerializer, sarifImporter, sensorSettings.asConfig());
    sensor.execute(sensorContext);

    verify(sarifImporter).importSarif(reportAndResults2.getSarifReport());
    assertThat(logTester.logs(Level.WARN)).contains("Failed to process SARIF report from file 'path/to/sarif/file.sarif', error: 'import failed'");
    assertSummaryIsCorrectlyDisplayedForSuccessfulFile(FILE_2, reportAndResults2.getSarifImportResults());
  }