{
MimeMessage renderedMessage = getRenderedMailMessage("/plain.xhtml");
// Test the standard headers
InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
Assert.assertEquals(to.getAddress(), "test@example.com");
Assert.assertEquals(to.getPersonal(), "Pete Muir");
InternetAddress from = (InternetAddress) renderedMessage.getFrom()[0];
Assert.assertEquals(from.getAddress(), "do-not-reply@jboss.com");
Assert.assertEquals(from.getPersonal(), "Seam");
Assert.assertEquals(renderedMessage.getReplyTo().length, 1);
Assert.assertTrue(renderedMessage.getReplyTo()[0] instanceof InternetAddress);
InternetAddress replyTo = (InternetAddress) renderedMessage.getReplyTo()[0];
Assert.assertEquals(replyTo.getAddress(), "another.address@jboss.org");
Assert.assertEquals(replyTo.getPersonal(), "JBoss");
Assert.assertEquals(renderedMessage.getRecipients(CC).length, 1);
Assert.assertTrue(renderedMessage.getRecipients(CC)[0] instanceof InternetAddress);
InternetAddress cc = (InternetAddress) renderedMessage.getRecipients(CC)[0];
Assert.assertEquals(cc.getAddress(), "test@example.com");
Assert.assertEquals(cc.getPersonal(), "Pete Muir");
Assert.assertEquals(renderedMessage.getRecipients(BCC).length, 1);
Assert.assertTrue(renderedMessage.getRecipients(BCC)[0] instanceof InternetAddress);
InternetAddress bcc = (InternetAddress) renderedMessage.getRecipients(CC)[0];
Assert.assertEquals(bcc.getAddress(), "test@example.com");
Assert.assertEquals(bcc.getPersonal(), "Pete Muir");
Assert.assertEquals(renderedMessage.getHeader("Precedence")[0], "bulk");
// Importance
Assert.assertNotNull(renderedMessage.getHeader("X-Priority"));
Assert.assertNotNull(renderedMessage.getHeader("Priority"));
Assert.assertNotNull(renderedMessage.getHeader("Importance"));