package com.effektif.workflow.test;

/**
 * Created by pedro on 12-03-2015.
 */
public class EmailStoreTest {

}

@@ -34,80 +34,2490 @@
 t;%0A%0A
-/**%0A * Created by pedro on 12-03-2015.%0A */%0Apublic class EmailStoreTest %7B%0A
+import com.effektif.workflow.api.Configuration;%0Aimport com.effektif.workflow.api.model.EmailId;%0Aimport com.effektif.workflow.impl.email.Email;%0Aimport com.effektif.workflow.impl.email.EmailStore;%0Aimport com.effektif.workflow.impl.memory.TestConfiguration;%0Aimport com.sun.tools.javac.util.List;%0Aimport junit.framework.TestCase;%0Aimport org.junit.Test;%0A%0A/**%0A * Tests %7B@link com.effektif.workflow.impl.email.EmailStore%7D storage and retrieval.%0A */%0Apublic class EmailStoreTest extends TestCase %7B%0A%0A  protected static Configuration configuration;%0A  protected static EmailStore emailStore;%0A%0A%0A  private Email mail;%0A%0A  @Override protected void setUp() throws Exception %7B%0A    if (configuration != null) %7B%0A      throw new IllegalStateException(%22already configured%22);%0A    %7D%0A%0A    configuration = new TestConfiguration();%0A    emailStore = configuration.get(EmailStore.class);%0A%0A    mail = new Email()%0A      .from(%22ci@example.com%22)%0A      .replyTo(%22ci@example.com%22)%0A      .headers(%22X-SourceWorkflowId%22, %22release%22)%0A      .to(List.of(%22dev@example.com%22))%0A      .cc(List.of(%22releases@example.com%22))%0A      .bcc(List.of(%22archive@example.com%22))%0A      .subject(%22New release%22)%0A      .bodyText(%22A new version has been deployed on production.%22)%0A      .bodyHtml(%22%3Cp%3EA new version has been deployed on production.%3C/p%3E%22);%0A    mail.setOrganizationId(%2243%22);%0A  %7D%0A%0A  @Test%0A  public void testStoreEmail() %7B%0A    EmailId newEmailId = emailStore.createEmail(mail).getId();%0A    Email storedMail = emailStore.findEmailById(newEmailId);%0A    assertNotNull(storedMail);%0A%0A    assertEquals(mail.getFrom(), storedMail.getFrom());%0A    assertEquals(mail.getReplyTo(), storedMail.getReplyTo());%0A%0A    assertTrue(storedMail.getHeaders().containsKey(%22X-SourceWorkflowId%22));%0A    assertEquals(mail.getHeaders().get(%22X-SourceWorkflowId%22), storedMail.getHeaders().get(%22X-SourceWorkflowId%22));%0A%0A    assertEquals(1, mail.getTo().size());%0A    assertEquals(1, mail.getCc().size());%0A    assertEquals(1, mail.getBcc().size());%0A%0A    assertEquals(mail.getTo().get(0), storedMail.getTo().get(0));%0A    assertEquals(mail.getCc().get(0), storedMail.getCc().get(0));%0A    assertEquals(mail.getBcc().get(0), storedMail.getBcc().get(0));%0A%0A    assertEquals(mail.getSubject(), storedMail.getSubject());%0A    assertEquals(mail.getBodyText(), storedMail.getBodyText());%0A    assertEquals(mail.getBodyHtml(), storedMail.getBodyHtml());%0A    assertEquals(mail.getId(), storedMail.getId());%0A    assertEquals(mail.getOrganizationId(), storedMail.getOrganizationId());%0A  %7D
 %0A%7D%0A

Add test