Class AbstractSubscriptionEmailTest

All Implemented Interfaces:
FunctTestConstants
Direct Known Subclasses:
TestEmailSubscription, TestSharedEmailSubscription, TestSubscriptionsWithTimeZones

public abstract class AbstractSubscriptionEmailTest extends EmailBaseFuncTestCase
An abstract class for tests that check the integrity of subscription e-mails.
Since:
v3.13
  • Constructor Details

    • AbstractSubscriptionEmailTest

      public AbstractSubscriptionEmailTest()
  • Method Details

    • assertTextMessageValid

      protected String assertTextMessageValid(jakarta.mail.internet.MimeMessage message, AbstractSubscriptionEmailTest.FilterConfig config, String from, String to, String userName) throws Exception
      Assert that a text subscription has the correct header, start and issue content. The optional content at the end of the e-mail will also need to be validated.
      Parameters:
      message - the message to validate.
      config - the filter that generated the subscription e-mail.
      from - the expected location where the e-mail should be from.
      to - the expected location where the e-mail should be delivered to.
      userName - the username to associated with the e-mail. This is the person who created the subscroption (not the filter).
      Returns:
      the passed string minus all the content at the top of the email that has already been validated.
      Throws:
      Exception - test just throws exception when unexpected error occurs to fail the test.
    • assertHtmlMessageValid

      protected String assertHtmlMessageValid(jakarta.mail.internet.MimeMessage message, AbstractSubscriptionEmailTest.FilterConfig config, String from, String to, String userName) throws Exception
      Assert that a html subscription has the correct header, start and issue content. The optional content at the end of the e-mail will also need to be validated.
      Parameters:
      message - the message to validate.
      config - the filter that generated the subscription e-mail.
      from - the expected location where the e-mail should be from.
      to - the expected location where the e-mail should be delivered to.
      userName - the username to associated with the e-mail. This is the person who created the subscroption (not the filter).
      Returns:
      the passed string minus all the content at the top of the email that has already been validated.
      Throws:
      Exception - test just throws exception when unexpected error occurs to fail the test.
    • assertPartialLinkText

      protected static String assertPartialLinkText(AbstractSubscriptionEmailTest.FilterConfig filterConfig, String body)
      Ensure that the passed message has a link to display the full results of the search.
      Parameters:
      filterConfig - the filter that produced the e-mail.
      body - the body of the text e-mail.
      Returns:
      a string of the message minus the partial link.
    • assertPartialLinkHtml

      protected static String assertPartialLinkHtml(AbstractSubscriptionEmailTest.FilterConfig filterConfig, String body)
      Ensure that the passed message has a link to display the full results of the search.
      Parameters:
      filterConfig - the filter that produced the e-mail.
      body - the body of the html e-mail.
      Returns:
      a string of the message minus the partial link.
    • assertNotPartialLink

      protected static void assertNotPartialLink(String body)
      Ensure that the passed message does not have a link to see full seach results as all issues can be seen in the e-mail.
      Parameters:
      body - the body of the e-mail to search.
    • assertEditLinkText

      protected static String assertEditLinkText(String body)
      Ensure that the message has a link to edit the subscription.
      Parameters:
      body - the body of the text message to check.
      Returns:
      a string of the message minus the edit link.
    • assertEditLinkHtml

      protected static String assertEditLinkHtml(String body)
      Ensure that the message has a link to edit the subscription.
      Parameters:
      body - the body of the html message to check.
      Returns:
      a string of the message minus the edit link.
    • assertNotEditLink

      protected static void assertNotEditLink(String body)
      Ensure that the message does not have a link to edit the subscription.
      Parameters:
      body - the string of the message minus the edit link.
    • subscribeToFilterAndRun

      protected void subscribeToFilterAndRun(AbstractSubscriptionEmailTest.FilterConfig config, String group)
      Subscribe the current user to a filter and then run it.
      Parameters:
      config - the configuration for the filter to subscribe to.
      group - the group to subscribe to the filter for. This can be left null to indicate that a personal subscription should be made.