@Test public void subject() { Notification notification = newNotification(); EmailMessage message = template.format(notification); assertThat(message.getSubject()).isEqualTo("Struts: 32 new issues (new debt: 1d3h)"); }
@Test public void message_id() { Notification notification = newNotification(); EmailMessage message = template.format(notification); assertThat(message.getMessageId()).isEqualTo("new-issues/org.apache:struts"); }
@Test public void do_not_add_footer_when_properties_missing() { Notification notification = new Notification(NewIssuesNotification.TYPE) .setFieldValue(SEVERITY + ".count", "32") .setFieldValue("projectName", "Struts"); EmailMessage message = template.format(notification); assertThat(message.getMessage()).doesNotContain("See it"); }
@Test public void format_email_with_no_assignees_tags_nor_components() throws Exception { Notification notification = newNotification(); EmailMessage message = template.format(notification); // TODO datetime to be completed when test is isolated from JVM timezone String expectedContent = IOUtils.toString( getClass().getResource("NewIssuesEmailTemplateTest/email_with_partial_details.txt"), StandardCharsets.UTF_8); assertThat(message.getMessage()).startsWith(expectedContent); }
@Test public void no_format_is_not_the_correct_notification() { Notification notification = new Notification("my-new-issues"); EmailMessage message = template.format(notification); assertThat(message).isNull(); }