protected abstract boolean shouldNotFormat(Notification notification);
protected String subject(Notification notification, String fullProjectName) {
- return String.format("%s: %s new issues (new debt: %s)",
+ int issueCount = Integer.parseInt(notification.getFieldValue(Metric.RULE_TYPE + COUNT));
+ return String.format("%s: %s new issue%s (new debt: %s)",
fullProjectName,
- notification.getFieldValue(Metric.RULE_TYPE + COUNT),
+ issueCount,
+ issueCount > 1 ? "s" : "",
notification.getFieldValue(Metric.EFFORT + COUNT));
}
@Override
protected String subject(Notification notification, String fullProjectName) {
- return String.format("You have %s new issues on project %s",
- notification.getFieldValue(Metric.RULE_TYPE + COUNT),
+ int issueCount = Integer.parseInt(notification.getFieldValue(Metric.RULE_TYPE + COUNT));
+ return String.format("You have %s new issue%s on project %s",
+ issueCount,
+ issueCount > 1 ? "s" : "",
fullProjectName);
}
EmailMessage message = underTest.format(notification);
+ assertThat(message.getSubject())
+ .isEqualTo("You have 1 new issue on project Struts");
assertThat(message.getMessage())
.contains("1 new issue (new debt: 1d3h)\n");
}
EmailMessage message = template.format(notification);
+ assertThat(message.getSubject())
+ .isEqualTo("Struts: 1 new issue (new debt: 1d3h)");
assertThat(message.getMessage())
.contains("1 new issue (new debt: 1d3h)\n");
}