Here's a quick overview of a feature I've been wanting to add to Seam for ages. It's really easy to use - just create a standard SeamTest and inside the invokeApplication() call getRenderedMailMessage(viewIdOfMailMessageToRender). You can then make assertion's against the returned MimeMessage.
public class MailTest extends SeamTest { @Test public void testSimpleMessage() throws Exception { new FacesRequest() { @Override protected void invokeApplication() throws Exception { MimeMessage renderedMessage = getRenderedMailMessage("/simple.xhtml"); assert renderedMessage.getAllRecipients().length == 1; InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0]; assert to.getAddress().equals("test@example.com"); } }.run(); } }
This is still a feature under development so if you try it out and can't get it working, post on the forum