use of com.enonic.xp.mail.MailService in project xp by enonic.
the class SendMailScriptTest method testFailMissingTo.
@Test
public void testFailMissingTo() throws Exception {
final MailService mailService = message -> {
throw new RuntimeException("Error sending mail");
};
addService(MailService.class, mailService);
try {
runFunction("/test/send-test.js", "sendWithoutRequiredTo");
fail("Expected exception");
} catch (ResourceProblemException e) {
assertEquals("Parameter 'to' is required", e.getMessage());
}
assertNull(this.actualMessage);
}
use of com.enonic.xp.mail.MailService in project xp by enonic.
the class SendMailScriptTest method testFailMissingFrom.
@Test
public void testFailMissingFrom() throws Exception {
final MailService mailService = message -> {
throw new RuntimeException("Error sending mail");
};
addService(MailService.class, mailService);
try {
runFunction("/test/send-test.js", "sendWithoutRequiredFrom");
fail("Expected exception");
} catch (ResourceProblemException e) {
assertEquals("Parameter 'from' is required", e.getMessage());
}
assertNull(this.actualMessage);
}
use of com.enonic.xp.mail.MailService in project xp by enonic.
the class SendMailScriptTest method initialize.
@Override
public void initialize() throws Exception {
super.initialize();
final MailService mailService = message -> this.actualMessage = message;
addService(MailService.class, mailService);
}
use of com.enonic.xp.mail.MailService in project xp by enonic.
the class SendMailScriptTest method testFailSendMail.
@Test
public void testFailSendMail() throws Exception {
final MailService mailService = message -> {
throw new RuntimeException("Error sending mail");
};
addService(MailService.class, mailService);
runFunction("/test/send-test.js", "failSendMail");
assertNull(this.actualMessage);
}
Aggregations