Class MailAssertions


  • public class MailAssertions
    extends Object
    Assertions on Mail messages.
    Since:
    4.2
    • Constructor Detail

      • MailAssertions

        public MailAssertions()
    • Method Detail

      • assertFirstRecipient

        public static void assertFirstRecipient​(javax.mail.internet.MimeMessage message,
                                                User user)
      • assertBodyDoesNotContainPageTitle

        public static void assertBodyDoesNotContainPageTitle​(javax.mail.internet.MimeMessage message,
                                                             Page page)
      • assertStandardNotificationHeaders

        public static void assertStandardNotificationHeaders​(javax.mail.internet.MimeMessage smtpMessage,
                                                             String toAddress,
                                                             String spaceTitle,
                                                             String pageTitle)
                                                      throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException
      • assertStandardHeaders

        public static void assertStandardHeaders​(javax.mail.internet.MimeMessage message,
                                                 User user,
                                                 AbstractPageEntity page)
                                          throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException
      • assertStandardNotificationHeaders

        public static void assertStandardNotificationHeaders​(javax.mail.internet.MimeMessage smtpMessage,
                                                             String toAddress,
                                                             String subject)
                                                      throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException
      • assertHasMail

        public static void assertHasMail​(List<javax.mail.internet.MimeMessage> originalMessages,
                                         User user,
                                         String... htmlExcerpts)
                                  throws Exception
        Assert at least one email among those received by user matches all the excerpts.
        Parameters:
        originalMessages - messages from the mail facade
        user - the recipient
        htmlExcerpts - the excerpt that the message must contain
        Throws:
        Exception - in case of error when fetching mail
      • assertHasPartWithHeader

        public static void assertHasPartWithHeader​(javax.mail.internet.MimeMessage message,
                                                   String headerName,
                                                   String expected)
                                            throws IOException,
                                                   javax.mail.MessagingException
        Throws:
        IOException
        javax.mail.MessagingException
      • assertHasNoPartWithHeader

        public static void assertHasNoPartWithHeader​(javax.mail.internet.MimeMessage message,
                                                     String headerName,
                                                     String forbidden)
                                              throws IOException,
                                                     javax.mail.MessagingException
        Throws:
        IOException
        javax.mail.MessagingException