public ExternalIssueReport parse(Path reportPath) {
    try (Reader reader = Files.newBufferedReader(reportPath, StandardCharsets.UTF_8)) {
      ExternalIssueReport report = gson.fromJson(reader, ExternalIssueReport.class);
      externalIssueReportValidator.validate(report, reportPath);
      return report;
    } catch (JsonIOException | IOException e) {
      throw new IllegalStateException("Failed to read external issues report '" + reportPath + "'", e);
    } catch (JsonSyntaxException e) {
      throw new IllegalStateException("Failed to read external issues report '" + reportPath + "': invalid JSON syntax", e);
    }
  }
@Test
  public void parse_whenInvalidDeprecatedFormat_shouldFail() {
    reportPath = Paths.get(DEPRECATED_REPORTS_LOCATION + "report_invalid_json.json");

    assertThatThrownBy(() -> externalIssueReportParser.parse(reportPath))
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("Failed to read external issues report 'src/test/resources/org/sonar/scanner/externalissue/report_invalid_json.json': " +
        "invalid JSON syntax");
  }