@Override
  public Hotspots.HotspotLite generateIssueMessage(IssueDto hotspotDto, RuleDto ruleDto) {
    Hotspots.HotspotLite.Builder builder = Hotspots.HotspotLite.newBuilder()
      .setKey(hotspotDto.getKey())
      .setFilePath(hotspotDto.getFilePath())
      .setStatus(hotspotDto.getStatus())
      .setRuleKey(hotspotDto.getRuleKey().toString())
      .setStatus(hotspotDto.getStatus())
      .setVulnerabilityProbability(getVulnerabilityProbability(ruleDto));

    if (hotspotDto.getIssueCreationTime() != null) {
      builder.setCreationDate(hotspotDto.getIssueCreationTime());
    }

    String resolution = hotspotDto.getResolution();
    if (resolution != null) {
      builder.setResolution(resolution);
    }

    String assigneeLogin = hotspotDto.getAssigneeLogin();
    if (assigneeLogin != null) {
      builder.setAssignee(assigneeLogin);
    }

    String message = hotspotDto.getMessage();
    if (message != null) {
      builder.setMessage(message);
    }

    DbIssues.Locations mainLocation = hotspotDto.parseLocations();
    if (mainLocation != null) {
      Hotspots.TextRange textRange = getTextRange(mainLocation);
      builder.setTextRange(textRange);
    }
    return builder.build();
  }
@Test
  public void generateIssueMessage_shouldMapDtoFields() {
    Date creationDate = new Date();
    IssueDto issueDto = new IssueDto()
      .setKee("key")
      .setFilePath("/home/src/Class.java")
      .setProjectKey("my-project-key")
      .setStatus("REVIEWED")
      .setResolution("FIXED")
      .setRuleKey("repo", "rule")
      .setRuleUuid("rule-uuid-1")
      .setMessage("Look at me, I'm the issue now!")
      .setAssigneeLogin("assignee-login")
      .setIssueCreationDate(creationDate);

    DbIssues.Locations locations = DbIssues.Locations.newBuilder()
      .setTextRange(range(2, 3))
      .build();
    issueDto.setLocations(locations);

    RuleDto ruleDto = new RuleDto()
      .setSecurityStandards(Set.of("cwe:489,cwe:570,cwe:571"));

    HotspotLite result = underTest.generateIssueMessage(issueDto, ruleDto);
    assertThat(result).extracting(
        HotspotLite::getKey,
        HotspotLite::getFilePath,
        HotspotLite::getVulnerabilityProbability,
        HotspotLite::getStatus,
        HotspotLite::getResolution,
        HotspotLite::getRuleKey,
        HotspotLite::getAssignee,
        HotspotLite::getCreationDate)
      .containsExactly("key", "/home/src/Class.java", "LOW", "REVIEWED", "FIXED", "repo:rule", "assignee-login",
        DateUtils.dateToLong(creationDate));
  }