}
private static String buildAnalysisSubject(Project project) {
- StringBuilder res = new StringBuilder("Analysis has changed some of your issues in ");
- toString(res, project);
- return res.toString();
+ return "Analysis has changed some of your issues in " + toSubject(project);
}
private String buildAnalysisMessage(Project project, ChangesOnMyIssuesNotification notification) {
this.settings = settings;
}
+ /**
+ * Used to build the subject for the email
+ */
+ protected static String toSubject(Project project) {
+ return project.getProjectName() + project.getBranchName().map(branchName -> " (" + branchName + ")").orElse("");
+ }
+
/**
* Adds "projectName" or "projectName, branchName" if branchName is non null
*/
EmailMessage emailMessage = underTest.format(new ChangesOnMyIssuesNotification(analysisChange, changedIssues));
Project project = changedIssues.iterator().next().getProject();
- assertThat(emailMessage.getSubject()).isEqualTo("Analysis has changed some of your issues in " + project.getProjectName() + ", " + project.getBranchName().get());
+ assertThat(emailMessage.getSubject()).isEqualTo("Analysis has changed some of your issues in " + project.getProjectName() + " (" + project.getBranchName().get() + ")");
}
@Test