Record Class Message

java.lang.Object
java.lang.Record
ch.martinelli.oss.testcontainers.mailpit.Message

public record Message(String id, String messageId, Address from, List<Address> to, List<Address> cc, List<Address> bcc, List<Address> replyTo, String subject, int size, Instant created, boolean read, com.fasterxml.jackson.databind.JsonNode attachmentsNode, String snippet, List<String> tags) extends Record
Represents an email message from Mailpit.

This record handles both message summaries (from list endpoint) and detailed messages (from single message endpoint). The attachments field can be either an integer count (in summaries) or an array of attachment objects (in detailed view).

  • Constructor Details

    • Message

      public Message(String id, String messageId, Address from, List<Address> to, List<Address> cc, List<Address> bcc, List<Address> replyTo, String subject, int size, Instant created, boolean read, com.fasterxml.jackson.databind.JsonNode attachmentsNode, String snippet, List<String> tags)
      Creates an instance of a Message record class.
      Parameters:
      id - the value for the id record component
      messageId - the value for the messageId record component
      from - the value for the from record component
      to - the value for the to record component
      cc - the value for the cc record component
      bcc - the value for the bcc record component
      replyTo - the value for the replyTo record component
      subject - the value for the subject record component
      size - the value for the size record component
      created - the value for the created record component
      read - the value for the read record component
      attachmentsNode - the value for the attachmentsNode record component
      snippet - the value for the snippet record component
      tags - the value for the tags record component
  • Method Details

    • attachmentCount

      public int attachmentCount()
      Returns the number of attachments.
      Returns:
      attachment count
    • recipients

      public List<Address> recipients()
      Returns the list of recipients as a convenience method.
      Returns:
      list of recipient addresses, never null
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • messageId

      public String messageId()
      Returns the value of the messageId record component.
      Returns:
      the value of the messageId record component
    • from

      public Address from()
      Returns the value of the from record component.
      Returns:
      the value of the from record component
    • to

      public List<Address> to()
      Returns the value of the to record component.
      Returns:
      the value of the to record component
    • cc

      public List<Address> cc()
      Returns the value of the cc record component.
      Returns:
      the value of the cc record component
    • bcc

      public List<Address> bcc()
      Returns the value of the bcc record component.
      Returns:
      the value of the bcc record component
    • replyTo

      public List<Address> replyTo()
      Returns the value of the replyTo record component.
      Returns:
      the value of the replyTo record component
    • subject

      public String subject()
      Returns the value of the subject record component.
      Returns:
      the value of the subject record component
    • size

      public int size()
      Returns the value of the size record component.
      Returns:
      the value of the size record component
    • created

      public Instant created()
      Returns the value of the created record component.
      Returns:
      the value of the created record component
    • read

      public boolean read()
      Returns the value of the read record component.
      Returns:
      the value of the read record component
    • attachmentsNode

      public com.fasterxml.jackson.databind.JsonNode attachmentsNode()
      Returns the value of the attachmentsNode record component.
      Returns:
      the value of the attachmentsNode record component
    • snippet

      public String snippet()
      Returns the value of the snippet record component.
      Returns:
      the value of the snippet record component
    • tags

      public List<String> tags()
      Returns the value of the tags record component.
      Returns:
      the value of the tags record component