Search in sources :

Example 1 with MailgunService

use of teammates.logic.core.MailgunService in project teammates by TEAMMATES.

the class EmailSenderTest method testConvertToMailgun.

@Test
public void testConvertToMailgun() throws Exception {
    EmailWrapper wrapper = getTypicalEmailWrapper();
    try (FormDataMultiPart formData = new MailgunService().parseToEmail(wrapper)) {
        assertEquals(wrapper.getSenderName() + " <" + wrapper.getSenderEmail() + ">", formData.getField("from").getValue());
        assertEquals(wrapper.getRecipient(), formData.getField("to").getValue());
        assertEquals(wrapper.getBcc(), formData.getField("bcc").getValue());
        assertEquals(wrapper.getReplyTo(), formData.getField("h:Reply-To").getValue());
        assertEquals(wrapper.getSubject(), formData.getField("subject").getValue());
        assertEquals(wrapper.getContent(), formData.getField("html").getValue());
    }
}
Also used : MailgunService(teammates.logic.core.MailgunService) FormDataMultiPart(com.sun.jersey.multipart.FormDataMultiPart) EmailWrapper(teammates.common.util.EmailWrapper) Test(org.testng.annotations.Test)

Aggregations

FormDataMultiPart (com.sun.jersey.multipart.FormDataMultiPart)1 Test (org.testng.annotations.Test)1 EmailWrapper (teammates.common.util.EmailWrapper)1 MailgunService (teammates.logic.core.MailgunService)1