EmailService { String replaceUrlPlaceholder(String fileContents, String placeholder, String url) { if (!fileContents.contains(placeholder)) { LOG.warn("The file contents do not contain any instances of the URL placeholder {}", placeholder); } return fileContents.replaceAll(placeholder, url); } EmailService(MessageOptions messageOptions, MetricRegistry metrics); boolean sendVerificationEmail(Email to, String verificationUrl); String getSuccessHtml(); abstract boolean sendEmail(Email to,
                                    String subjectString,
                                    String htmlBodyString,
                                    String bodyString);  }
@Test void testReplacePlaceholderNoUrl() { String contents = "test contents"; String url = "http: assertEquals(contents, emailService.replaceUrlPlaceholder(contents, "CODEGEN-URL", url)); }
@Test void testReplacePlaceholderWithUrl() { String contents = "test contents CODEGEN-URL"; String url = "http: String expected = "test contents " + url; assertEquals(expected, emailService.replaceUrlPlaceholder(contents, "CODEGEN-URL", url)); }
@Test void testReplaceWithCustomPlaceholder() { String contents = "test contents PLACEHOLDER"; String url = "http: String expected = "test contents " + url; assertEquals(expected, emailService.replaceUrlPlaceholder(contents, "PLACEHOLDER", url)); }