Class GreenMailUtils


  • public class GreenMailUtils
    extends Object
    • Constructor Detail

      • GreenMailUtils

        public GreenMailUtils()
    • Method Detail

      • smtpServerSetup

        public static com.icegreen.greenmail.util.ServerSetup smtpServerSetup()
      • setUpGreenMail

        @Deprecated
        @NotNull
        public static @NotNull com.icegreen.greenmail.util.GreenMail setUpGreenMail​(@NotNull
                                                                                    @NotNull String email,
                                                                                    @NotNull
                                                                                    @NotNull String login,
                                                                                    @NotNull
                                                                                    @NotNull String password)
        Deprecated.
        This should be used only in non-JUnit tests. For JUnit tests use GreenMailRule
      • tearDownGreenMail

        @Deprecated
        public static void tearDownGreenMail​(@Nullable
                                             @Nullable com.icegreen.greenmail.base.GreenMailOperations greenMail)
        Deprecated.
        This should be used only in non-JUnit tests. For JUnit tests use GreenMailRule
      • nextFreePort

        public static int nextFreePort()
      • nextFreePort

        public static int nextFreePort​(int startingPort)
      • localLoopbackAddress

        @NotNull
        public static @NotNull String localLoopbackAddress()
      • waitForNoEmail

        public static void waitForNoEmail​(@NotNull
                                          @NotNull com.icegreen.greenmail.base.GreenMailOperations greenMail,
                                          Duration maxWaitTime)
      • waitForIncomingEmail

        @NotNull
        public static @NotNull List<javax.mail.internet.MimeMessage> waitForIncomingEmail​(@NotNull
                                                                                          @NotNull com.icegreen.greenmail.base.GreenMailOperations greenMail,
                                                                                          Duration maxWaitTime,
                                                                                          org.hamcrest.Matcher<String> matcher)
      • waitForIncomingEmail

        @NotNull
        public static @NotNull List<javax.mail.internet.MimeMessage> waitForIncomingEmail​(@NotNull
                                                                                          @NotNull com.icegreen.greenmail.base.GreenMailOperations greenMail,
                                                                                          Duration maxWaitTime,
                                                                                          int expectedEmailCount)
                                                                                   throws Exception
        Throws:
        Exception
      • cleanInbox

        public static void cleanInbox​(@NotNull
                                      @NotNull com.icegreen.greenmail.base.GreenMailOperations greenMail,
                                      @NotNull
                                      @NotNull List<String> users)
      • getMessageContent

        public static String getMessageContent​(@NotNull
                                               @NotNull javax.mail.BodyPart msg)
                                        throws IOException,
                                               javax.mail.MessagingException
        Extract email message from a BodyPart instance.
        Throws:
        IOException
        javax.mail.MessagingException
      • getMessageContent

        public static String getMessageContent​(javax.mail.internet.MimeMessage message)
                                        throws IOException,
                                               javax.mail.MessagingException
        Extract email message from a MimeMessage message.
        Throws:
        IOException
        javax.mail.MessagingException