[jboss-cvs] jboss-seam/examples/mail/src/org/jboss/seam/example/mail/test ...
Peter Muir
peter at bleepbleep.org.uk
Wed Oct 10 07:01:49 EDT 2007
User: pmuir
Date: 07/10/10 07:01:49
Modified: examples/mail/src/org/jboss/seam/example/mail/test
MailTest.java
Log:
Slight refactor, finish test for simple.xhtml
Revision Changes Path
1.2 +19 -5 jboss-seam/examples/mail/src/org/jboss/seam/example/mail/test/MailTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MailTest.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/mail/src/org/jboss/seam/example/mail/test/MailTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- MailTest.java 9 Oct 2007 13:58:50 -0000 1.1
+++ MailTest.java 10 Oct 2007 11:01:49 -0000 1.2
@@ -2,7 +2,9 @@
import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
import org.jboss.seam.mail.MailSession;
import org.jboss.seam.mail.MockTransport;
@@ -20,7 +22,7 @@
public void testSimpleMessage() throws Exception
{
- new MailTest("/simple.xhtml")
+ new FacesRequest()
{
@Override
@@ -32,10 +34,12 @@
}
@Override
- protected void testMessage(MimeMessage renderedMessage)
- throws Exception
+ protected void invokeApplication() throws Exception
{
+ MimeMessage renderedMessage = getRenderedMailMessage("/simple.xhtml");
+
assert MailSession.instance().getTransport() instanceof MockTransport;
+
assert renderedMessage != null;
assert renderedMessage.getAllRecipients().length == 1;
assert renderedMessage.getAllRecipients()[0] instanceof InternetAddress;
@@ -49,8 +53,18 @@
assert from.getPersonal().equals("Peter");
assert "Try out Seam!".equals(renderedMessage.getSubject());
assert renderedMessage.getContent() != null;
- }
+ assert renderedMessage.getContent() instanceof MimeMultipart;
+ MimeMultipart body = (MimeMultipart) renderedMessage.getContent();
+ assert body.getCount() == 1;
+ assert body.getBodyPart(0) != null;
+ assert body.getBodyPart(0) instanceof MimeBodyPart;
+ MimeBodyPart bodyPart = (MimeBodyPart) body.getBodyPart(0);
+ assert bodyPart.getContent() != null;
+ assert "text/html; charset=us-ascii".equals(bodyPart.getContentType());
+ assert "inline".equals(bodyPart.getDisposition());
+ assert bodyPart.isMimeType("text/html");
+ }
}.run();
}
More information about the jboss-cvs-commits
mailing list