[jboss-cvs] jboss-seam/doc/reference/en/modules ...
Peter Muir
peter at bleepbleep.org.uk
Tue Oct 9 09:58:51 EDT 2007
User: pmuir
Date: 07/10/09 09:58:51
Modified: doc/reference/en/modules mail.xml testing.xml
Log:
Initial support for integration testing Seam Mail - yay ( JBSEAM-1833) and a start at tests for the mail example
Revision Changes Path
1.27 +5 -0 jboss-seam/doc/reference/en/modules/mail.xml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: mail.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/doc/reference/en/modules/mail.xml,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- mail.xml 4 Sep 2007 11:43:00 -0000 1.26
+++ mail.xml 9 Oct 2007 13:58:51 -0000 1.27
@@ -16,6 +16,11 @@
example that demonstrate the key features currently supported.
</para>
+ <para>
+ You can also test your mail's using Seam's integration testing environment.
+ See <xref linkend="testing.mail" />.
+ </para>
+
<section>
<title>Creating a message</title>
1.18 +50 -0 jboss-seam/doc/reference/en/modules/testing.xml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: testing.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/doc/reference/en/modules/testing.xml,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- testing.xml 7 Oct 2007 22:22:15 -0000 1.17
+++ testing.xml 9 Oct 2007 13:58:51 -0000 1.18
@@ -398,6 +398,56 @@
</section>
+ <section id="testing.mail">
+ <title>Integration Testing Seam Mail</title>
+
+ <para>
+ Warning! This feature is still under development.
+ </para>
+
+ <para>
+ It's very easy to integration test your Seam Mail:
+ </para>
+
+ <programlisting><![CDATA[public class MailTest extends SeamTest {
+
+ @Test
+ public void testSimpleMessage() throws Exception {
+
+ new MailTest("/simple.xhtml") {
+
+ @Override
+ protected void updateModelValues() throws Exception {
+ setValue("#{person.firstname}", "Pete");
+ setValue("#{person.lastname}", "Muir");
+ setValue("#{person.address}", "test at example.com");
+ }
+
+ @Override
+ protected void testMessage(MimeMessage renderedMessage) throws Exception {
+ assert renderedMessage.getAllRecipients().length == 1;
+ InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
+ assert to.getAddress().equals("test at example.com");
+ }
+
+ }.run();
+ }
+}]]></programlisting>
+
+ <para>
+ We create a new <literal>MailTest</literal>, providing the
+ <literal>viewId</literal> of the mail template to render as an
+ argument. Do your assertions in the <literal>testMessage()</literal>
+ method - the sent message is passed in as an argument. You can of
+ course also use any of the standard JSF lifecycle methods.
+ </para>
+
+ <para>
+ There is no support for rendering standard JSF components so you
+ can't test the body of the mail message easily.
+ </para>
+ </section>
+
</section>
</chapter>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list