@Test public void getEligibilityMessage_should_be_eligible_when_isBlockingValidation_and_passed() { ExecutionDTO execution = new ExecutionDTO().withBlockingValidation(true).withQualityStatus(QualityStatus.PASSED); final String message = cut.getEligibilityMessage(execution); assertThat(message).contains(">eligible to deploy<"); assertThat(message).doesNotContain(">without much margin regarding the thresholds<"); }
String getEligibilityMessage(ExecutionDTO execution) { if (!execution.isBlockingValidation()) { return "Quality for this build:"; } else if (execution.getQualityStatus().isAcceptable()) { return "The build is <b style='background-color: #19be6b; color: white; padding: 1px 2px; border-radius: 2px;'>eligible to deploy</b>" + (execution.getQualityStatus() == QualityStatus.WARNING ? " but <b style='background-color: #ffcc30; padding: 1px 2px; border-radius: 2px;'>without much margin regarding the thresholds</b>" : "") + ":"; } else { return "The build is <b style='background-color: #ed3f14; color: white; padding: 1px 2px; border-radius: 2px;'>not eligible to deploy</b>:"; } }
QualityEmailService { String getEligibilityMessage(ExecutionDTO execution) { if (!execution.isBlockingValidation()) { return "Quality for this build:"; } else if (execution.getQualityStatus().isAcceptable()) { return "The build is <b style='background-color: #19be6b; color: white; padding: 1px 2px; border-radius: 2px;'>eligible to deploy</b>" + (execution.getQualityStatus() == QualityStatus.WARNING ? " but <b style='background-color: #ffcc30; padding: 1px 2px; border-radius: 2px;'>without much margin regarding the thresholds</b>" : "") + ":"; } else { return "The build is <b style='background-color: #ed3f14; color: white; padding: 1px 2px; border-radius: 2px;'>not eligible to deploy</b>:"; } } }
QualityEmailService { String getEligibilityMessage(ExecutionDTO execution) { if (!execution.isBlockingValidation()) { return "Quality for this build:"; } else if (execution.getQualityStatus().isAcceptable()) { return "The build is <b style='background-color: #19be6b; color: white; padding: 1px 2px; border-radius: 2px;'>eligible to deploy</b>" + (execution.getQualityStatus() == QualityStatus.WARNING ? " but <b style='background-color: #ffcc30; padding: 1px 2px; border-radius: 2px;'>without much margin regarding the thresholds</b>" : "") + ":"; } else { return "The build is <b style='background-color: #ed3f14; color: white; padding: 1px 2px; border-radius: 2px;'>not eligible to deploy</b>:"; } }  }
QualityEmailService { String getEligibilityMessage(ExecutionDTO execution) { if (!execution.isBlockingValidation()) { return "Quality for this build:"; } else if (execution.getQualityStatus().isAcceptable()) { return "The build is <b style='background-color: #19be6b; color: white; padding: 1px 2px; border-radius: 2px;'>eligible to deploy</b>" + (execution.getQualityStatus() == QualityStatus.WARNING ? " but <b style='background-color: #ffcc30; padding: 1px 2px; border-radius: 2px;'>without much margin regarding the thresholds</b>" : "") + ":"; } else { return "The build is <b style='background-color: #ed3f14; color: white; padding: 1px 2px; border-radius: 2px;'>not eligible to deploy</b>:"; } }  @Transactional(readOnly = true, noRollbackFor = Exception.class) void sendQualityEmail(long projectId, long executionId); }
QualityEmailService { String getEligibilityMessage(ExecutionDTO execution) { if (!execution.isBlockingValidation()) { return "Quality for this build:"; } else if (execution.getQualityStatus().isAcceptable()) { return "The build is <b style='background-color: #19be6b; color: white; padding: 1px 2px; border-radius: 2px;'>eligible to deploy</b>" + (execution.getQualityStatus() == QualityStatus.WARNING ? " but <b style='background-color: #ffcc30; padding: 1px 2px; border-radius: 2px;'>without much margin regarding the thresholds</b>" : "") + ":"; } else { return "The build is <b style='background-color: #ed3f14; color: white; padding: 1px 2px; border-radius: 2px;'>not eligible to deploy</b>:"; } }  @Transactional(readOnly = true, noRollbackFor = Exception.class) void sendQualityEmail(long projectId, long executionId);  }