@Test public void getSubject_should_show_CRASHED_when_empty_qualitySeverities() { ExecutionDTO execution = validExecution().withQualitySeverities(Collections.emptyList()); final String subject = cut.getSubject("anyProjectName", execution); assertThat(subject).contains(": \uD83D\uDCA5 CRASHED, TESTED ON "); }
String getSubject(String projectName, ExecutionDTO execution) { boolean crashed = crashed(execution); String eligibility; if (crashed) { eligibility = "\uD83D\uDCA5 CRASHED,"; } else if (!execution.isBlockingValidation()) { eligibility = "RAN"; } else if (execution.getQualityStatus() == QualityStatus.WARNING) { eligibility = "\u26A0\uFE0F ELIGIBLE"; } else if (execution.getQualityStatus() == QualityStatus.PASSED) { eligibility = "\u2705 ELIGIBLE"; } else { eligibility = "\u274C NOT ELIGIBLE"; } StringBuilder subject = new StringBuilder(); subject.append(projectName).append(' ') .append(execution.getBranch()).append('/').append(execution.getName()) .append(" NRT FOR ").append(execution.getRelease()).append(": ") .append(eligibility); if (!crashed) { subject.append(" ("); if (execution.getQualityStatus() == QualityStatus.INCOMPLETE) { subject.append("INCOMPLETE"); } else { appendSeverityPercentages(execution, subject); } subject.append(")"); } subject.append(" TESTED ON ").append(formatDate(execution.getTestDateTime())); return subject.toString().toUpperCase(); }
QualityEmailService { String getSubject(String projectName, ExecutionDTO execution) { boolean crashed = crashed(execution); String eligibility; if (crashed) { eligibility = "\uD83D\uDCA5 CRASHED,"; } else if (!execution.isBlockingValidation()) { eligibility = "RAN"; } else if (execution.getQualityStatus() == QualityStatus.WARNING) { eligibility = "\u26A0\uFE0F ELIGIBLE"; } else if (execution.getQualityStatus() == QualityStatus.PASSED) { eligibility = "\u2705 ELIGIBLE"; } else { eligibility = "\u274C NOT ELIGIBLE"; } StringBuilder subject = new StringBuilder(); subject.append(projectName).append(' ') .append(execution.getBranch()).append('/').append(execution.getName()) .append(" NRT FOR ").append(execution.getRelease()).append(": ") .append(eligibility); if (!crashed) { subject.append(" ("); if (execution.getQualityStatus() == QualityStatus.INCOMPLETE) { subject.append("INCOMPLETE"); } else { appendSeverityPercentages(execution, subject); } subject.append(")"); } subject.append(" TESTED ON ").append(formatDate(execution.getTestDateTime())); return subject.toString().toUpperCase(); } }
QualityEmailService { String getSubject(String projectName, ExecutionDTO execution) { boolean crashed = crashed(execution); String eligibility; if (crashed) { eligibility = "\uD83D\uDCA5 CRASHED,"; } else if (!execution.isBlockingValidation()) { eligibility = "RAN"; } else if (execution.getQualityStatus() == QualityStatus.WARNING) { eligibility = "\u26A0\uFE0F ELIGIBLE"; } else if (execution.getQualityStatus() == QualityStatus.PASSED) { eligibility = "\u2705 ELIGIBLE"; } else { eligibility = "\u274C NOT ELIGIBLE"; } StringBuilder subject = new StringBuilder(); subject.append(projectName).append(' ') .append(execution.getBranch()).append('/').append(execution.getName()) .append(" NRT FOR ").append(execution.getRelease()).append(": ") .append(eligibility); if (!crashed) { subject.append(" ("); if (execution.getQualityStatus() == QualityStatus.INCOMPLETE) { subject.append("INCOMPLETE"); } else { appendSeverityPercentages(execution, subject); } subject.append(")"); } subject.append(" TESTED ON ").append(formatDate(execution.getTestDateTime())); return subject.toString().toUpperCase(); }  }
QualityEmailService { String getSubject(String projectName, ExecutionDTO execution) { boolean crashed = crashed(execution); String eligibility; if (crashed) { eligibility = "\uD83D\uDCA5 CRASHED,"; } else if (!execution.isBlockingValidation()) { eligibility = "RAN"; } else if (execution.getQualityStatus() == QualityStatus.WARNING) { eligibility = "\u26A0\uFE0F ELIGIBLE"; } else if (execution.getQualityStatus() == QualityStatus.PASSED) { eligibility = "\u2705 ELIGIBLE"; } else { eligibility = "\u274C NOT ELIGIBLE"; } StringBuilder subject = new StringBuilder(); subject.append(projectName).append(' ') .append(execution.getBranch()).append('/').append(execution.getName()) .append(" NRT FOR ").append(execution.getRelease()).append(": ") .append(eligibility); if (!crashed) { subject.append(" ("); if (execution.getQualityStatus() == QualityStatus.INCOMPLETE) { subject.append("INCOMPLETE"); } else { appendSeverityPercentages(execution, subject); } subject.append(")"); } subject.append(" TESTED ON ").append(formatDate(execution.getTestDateTime())); return subject.toString().toUpperCase(); }  @Transactional(readOnly = true, noRollbackFor = Exception.class) void sendQualityEmail(long projectId, long executionId); }
QualityEmailService { String getSubject(String projectName, ExecutionDTO execution) { boolean crashed = crashed(execution); String eligibility; if (crashed) { eligibility = "\uD83D\uDCA5 CRASHED,"; } else if (!execution.isBlockingValidation()) { eligibility = "RAN"; } else if (execution.getQualityStatus() == QualityStatus.WARNING) { eligibility = "\u26A0\uFE0F ELIGIBLE"; } else if (execution.getQualityStatus() == QualityStatus.PASSED) { eligibility = "\u2705 ELIGIBLE"; } else { eligibility = "\u274C NOT ELIGIBLE"; } StringBuilder subject = new StringBuilder(); subject.append(projectName).append(' ') .append(execution.getBranch()).append('/').append(execution.getName()) .append(" NRT FOR ").append(execution.getRelease()).append(": ") .append(eligibility); if (!crashed) { subject.append(" ("); if (execution.getQualityStatus() == QualityStatus.INCOMPLETE) { subject.append("INCOMPLETE"); } else { appendSeverityPercentages(execution, subject); } subject.append(")"); } subject.append(" TESTED ON ").append(formatDate(execution.getTestDateTime())); return subject.toString().toUpperCase(); }  @Transactional(readOnly = true, noRollbackFor = Exception.class) void sendQualityEmail(long projectId, long executionId);  }