Search in sources :

Example 1 with SendgridService

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

the class EmailSenderTest method testConvertToSendgrid.

@Test
public void testConvertToSendgrid() {
    EmailWrapper wrapper = getTypicalEmailWrapper();
    Mail email = new SendgridService().parseToEmail(wrapper);
    assertEquals(wrapper.getSenderEmail(), email.getFrom().getEmail());
    assertEquals(wrapper.getSenderName(), email.getFrom().getName());
    assertEquals(wrapper.getRecipient(), email.personalization.get(0).getTos().get(0).getEmail());
    assertEquals(wrapper.getBcc(), email.personalization.get(0).getBccs().get(0).getEmail());
    assertEquals(wrapper.getReplyTo(), email.getReplyto().getEmail());
    assertEquals(wrapper.getSubject(), email.getSubject());
    assertEquals("text/plain", email.getContent().get(0).getType());
    assertEquals(Jsoup.parse(wrapper.getContent()).text(), email.getContent().get(0).getValue());
    assertEquals("text/html", email.getContent().get(1).getType());
    assertEquals(wrapper.getContent(), email.getContent().get(1).getValue());
}
Also used : Mail(com.sendgrid.Mail) SendgridService(teammates.logic.core.SendgridService) EmailWrapper(teammates.common.util.EmailWrapper) Test(org.testng.annotations.Test)

Aggregations

Mail (com.sendgrid.Mail)1 Test (org.testng.annotations.Test)1 EmailWrapper (teammates.common.util.EmailWrapper)1 SendgridService (teammates.logic.core.SendgridService)1