[jbpm-commits] JBoss JBPM SVN: r6964 - jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/mail.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jul 13 08:02:51 EDT 2011


Author: marco.rietveld
Date: 2011-07-13 08:02:50 -0400 (Wed, 13 Jul 2011)
New Revision: 6964

Modified:
   jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/mail/MailTest.java
Log:
Added *StaticMethod() tests, because of an issue that I can no longer remember. Sorry!

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/mail/MailTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/mail/MailTest.java	2011-07-06 11:12:35 UTC (rev 6963)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/mail/MailTest.java	2011-07-13 12:02:50 UTC (rev 6964)
@@ -1,8 +1,10 @@
 package org.jbpm.mail;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Properties;
 
 import javax.mail.Address;
 import javax.mail.MessagingException;
@@ -76,6 +78,28 @@
     assert Arrays.equals(InternetAddress.parse("sample.shipper at example.domain"), email.getRecipients(RecipientType.TO));
   }
 
+  public void testWithoutAddressResolvingStaticMethod() throws MessagingException, IOException {
+    String to = "sample.shipper at example.domain";
+    String subject = "latest news";
+    String text = "roy is assurancetourix";
+  
+    Properties serverProperties = new Properties();
+    serverProperties.setProperty("mail.smtp.port", "2525");
+    serverProperties.setProperty("mail.smtp.host", "localhost");
+    ArrayList recipients = new ArrayList();
+    recipients.add(to);
+    Mail.send(serverProperties, null, recipients, subject, text);
+  
+    List messages = wiser.getMessages();
+    assertEquals(1, messages.size());
+  
+    WiserMessage message = (WiserMessage) messages.get(0);
+    MimeMessage email = message.getMimeMessage();
+    assertEquals("latest news", email.getSubject());
+    assertEquals("roy is assurancetourix", email.getContent());
+    assert Arrays.equals(InternetAddress.parse("sample.shipper at example.domain"), email.getRecipients(RecipientType.TO));
+  }
+
   public void testMailWithAddressResolving() throws MessagingException, IOException {
     String actors = "manager";
     String subject = "latest news";
@@ -93,7 +117,7 @@
     assertEquals("roy is assurancetourix", email.getContent());
     assert Arrays.equals(InternetAddress.parse("manager at example.domain"), email.getRecipients(RecipientType.TO));
   }
-
+  
   public void testMailWithBccAddress() throws MessagingException, IOException {
     String bcc = "bcc at example.domain";
     String subject = "latest news";
@@ -111,7 +135,30 @@
     assertEquals("roy is assurancetourix", email.getContent());
     assertNull(email.getRecipients(RecipientType.TO));
   }
+  
+  public void testMailWithBccAddressStaticMethod() throws MessagingException, IOException {
+    String bcc = "bcc at example.domain";
+    String subject = "latest news";
+    String text = "roy is assurancetourix";
 
+    Properties serverProperties = new Properties();
+    serverProperties.setProperty("mail.smtp.port", "2525");
+    serverProperties.setProperty("mail.smtp.host", "localhost");
+    ArrayList bccRecipients = new ArrayList();
+    bccRecipients.add(bcc);
+    Mail.send(serverProperties, null, null, bccRecipients, subject, text);
+
+    List messages = wiser.getMessages();
+    assertEquals(1, messages.size());
+
+    WiserMessage message = (WiserMessage) messages.get(0);
+    MimeMessage email = message.getMimeMessage();
+    assertEquals("latest news", email.getSubject());
+    assertEquals("roy is assurancetourix", email.getContent());
+    assertNull(email.getRecipients(RecipientType.TO));
+  }
+
+
   public void testMailNodeAttributes() throws MessagingException, IOException {
     ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(XML_DECL
       + "<process-definition>"



More information about the jbpm-commits mailing list