KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > mail > MgnlMailFactoryTest


1 package info.magnolia.cms.mail;
2
3 /**
4  *
5  * Date: Mar 31, 2006
6  * Time: 9:14:00 PM
7  * @author <a HREF="mailto:niko@macnica.com">Nicolas Modrzyk</a>
8  */

9
10 import info.magnolia.cms.mail.templates.MgnlEmail;
11
12 import java.util.Iterator JavaDoc;
13
14 import org.subethamail.wiser.WiserMessage;
15
16 public class MgnlMailFactoryTest extends AbstractMailTest {
17
18     public void testSimpleMail() throws Exception JavaDoc {
19         MgnlEmail email = factory.getEmailFromType(MailConstants.MAIL_TEMPLATE_TEXT);
20         String JavaDoc subject = "Test simple";
21         email.setText("Hello bonjour");
22         email.setSubject(subject);
23         email.setToList(TEST_RECIPIENT);
24         email.setFrom(TEST_SENDER);
25         handler.prepareAndSendMail(email);
26
27         assertTrue(wiser.getMessages().size() == 1);
28         Iterator JavaDoc emailIter = wiser.getMessages().iterator();
29         WiserMessage message = (WiserMessage) emailIter.next();
30         assertTrue(message.getMimeMessage().getSubject().equals(subject));
31     }
32
33 }
34
Popular Tags