Class Mailpit

java.lang.Object
com.irurueta.authserver.testsupport.Mailpit

public final class Mailpit extends Object
Describes the Mailpit container the one-time token tests read the e-mail of: the pinned image, its two ports and a factory that builds the container and the client of its HTTP API. Mailpit accepts any message over SMTP and exposes what it received over HTTP, so a test reads the code or the link the application mailed.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Port the HTTP API listens on inside the container.
    static final String
    Docker image of Mailpit, pinned to a version so a run never depends on a moving tag.
    private static final String
    Path that answers once the HTTP API is ready.
    static final int
    Port the SMTP server listens on inside the container.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Prevents instantiation of this utility class.
  • Method Summary

    Modifier and Type
    Method
    Description
    clientOf(org.testcontainers.containers.GenericContainer<?> container)
    Builds the client of the HTTP API of a started container.
    static org.testcontainers.containers.GenericContainer<?>
    Creates a Mailpit container, not yet started.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • IMAGE

      public static final String IMAGE
      Docker image of Mailpit, pinned to a version so a run never depends on a moving tag.
      See Also:
    • SMTP_PORT

      public static final int SMTP_PORT
      Port the SMTP server listens on inside the container.
      See Also:
    • API_PORT

      public static final int API_PORT
      Port the HTTP API listens on inside the container.
      See Also:
    • READY_PATH

      private static final String READY_PATH
      Path that answers once the HTTP API is ready.
      See Also:
  • Constructor Details

    • Mailpit

      private Mailpit()
      Prevents instantiation of this utility class.
  • Method Details

    • newContainer

      public static org.testcontainers.containers.GenericContainer<?> newContainer()
      Creates a Mailpit container, not yet started.
      Returns:
      the container, which waits for the HTTP API to answer before it counts as started.
    • clientOf

      public static MailpitClient clientOf(org.testcontainers.containers.GenericContainer<?> container)
      Builds the client of the HTTP API of a started container.
      Parameters:
      container - a started Mailpit container.
      Returns:
      the client.