Record Class MailpitClient.Message

java.lang.Object
java.lang.Record
com.irurueta.authserver.testsupport.MailpitClient.Message
Record Components:
id - identifier Mailpit gave it.
subject - subject of the message.
text - plain-text body.
html - HTML body, empty when the message has none.
Enclosing class:
MailpitClient

public static record MailpitClient.Message(String id, String subject, String text, String html) extends Record
A message Mailpit received.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final String
    The field for the html record component.
    private final String
    The field for the id record component.
    private final String
    The field for the subject record component.
    private final String
    The field for the text record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Message(String id, String subject, String text, String html)
    Creates an instance of a Message record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Reads the numeric code of the message.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the html record component.
    id()
    Returns the value of the id record component.
    Reads the full magic link of the message, as the user would open it.
    Reads the token of the magic link the message carries.
    Returns the value of the subject record component.
    Returns the value of the text record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • id

      private final String id
      The field for the id record component.
    • subject

      private final String subject
      The field for the subject record component.
    • text

      private final String text
      The field for the text record component.
    • html

      private final String html
      The field for the html record component.
  • Constructor Details

    • Message

      public Message(String id, String subject, String text, String html)
      Creates an instance of a Message record class.
      Parameters:
      id - the value for the id record component
      subject - the value for the subject record component
      text - the value for the text record component
      html - the value for the html record component
  • Method Details

    • linkToken

      public String linkToken()
      Reads the token of the magic link the message carries.
      Returns:
      the token of the link.
      Throws:
      IllegalStateException - if the message carries no link.
    • link

      public String link()
      Reads the full magic link of the message, as the user would open it.
      Returns:
      the URL of the link.
      Throws:
      IllegalStateException - if the message carries no link.
    • code

      public String code()
      Reads the numeric code of the message.
      Returns:
      the digits of the code.
      Throws:
      IllegalStateException - if the message carries no code.
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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
    • subject

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

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • html

      public String html()
      Returns the value of the html record component.
      Returns:
      the value of the html record component