public RuleDto addDefaultImpact(ImpactDto defaultImpactDto) {
    defaultImpacts.stream().filter(impactDto -> impactDto.getSoftwareQuality() == defaultImpactDto.getSoftwareQuality()).findFirst()
      .ifPresent(impactDto -> {
        throw new IllegalStateException(format("Impact already defined on rule for Software Quality [%s]", defaultImpactDto.getSoftwareQuality()));
      });
    defaultImpacts.add(defaultImpactDto);
    return this;
  }
@Test
  void addDefaultImpact_whenSoftwareQualityAlreadyDefined_shouldThrowISE() {
    RuleDto dto = new RuleDto();
    dto.addDefaultImpact(newImpactDto(SoftwareQuality.MAINTAINABILITY, Severity.LOW));

    ImpactDto duplicatedImpact = newImpactDto(SoftwareQuality.MAINTAINABILITY, Severity.HIGH);

    assertThatThrownBy(() -> dto.addDefaultImpact(duplicatedImpact))
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("Impact already defined on rule for Software Quality [MAINTAINABILITY]");
  }