RunMapperResult mapRun(Run run) {
    if (run.getResults().isEmpty()) {
      return new RunMapperResult();
    }

    String driverName = getToolDriverName(run);
    Map<String, Result.Level> ruleSeveritiesByRuleId = detectRulesSeverities(run, driverName);
    Map<String, Result.Level> ruleSeveritiesByRuleIdForNewCCT = detectRulesSeveritiesForNewTaxonomy(run, driverName);

    return new RunMapperResult()
      .newAdHocRules(toNewAdHocRules(run, driverName, ruleSeveritiesByRuleId, ruleSeveritiesByRuleIdForNewCCT))
      .newExternalIssues(toNewExternalIssues(run, driverName, ruleSeveritiesByRuleId, ruleSeveritiesByRuleIdForNewCCT));
  }
@Test
  public void mapRun_ifRunIsEmpty_returnsEmptyList() {
    when(run.getResults()).thenReturn(List.of());

    RunMapperResult runMapperResult = runMapper.mapRun(run);

    assertThat(runMapperResult.getNewExternalIssues()).isEmpty();
  }