Interface ResponseMailpitInterface

All Known Implementing Classes:
AssertableMailpitResponse

public interface ResponseMailpitInterface
  • Method Details

    • check

      Asserts that the response body is valid for subsequent checks.

      Used internally by EmailMailpit methods.

      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeResponseBodyFieldMatch

      AssertableMailpitResponse seeResponseBodyFieldMatch(String path, org.hamcrest.Matcher<?> matcher)
      Asserts that the email message body matches the specified matcher.

      NOTE: Use for some custom asserts or not yet supported features

      Parameters:
      path - path to the field (for example: data.user.id)
      matcher - Matcher
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailBodyEqual

      AssertableMailpitResponse seeEmailBodyEqual(String expectedBody)
      Asserts that the email message body equals the expected string.
      Parameters:
      expectedBody - expected email body
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailBodyContains

      AssertableMailpitResponse seeEmailBodyContains(String expectedSubString)
      Asserts that the email message body contains the expected string.
      Parameters:
      expectedSubString - expected substring
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailSubjectEqual

      AssertableMailpitResponse seeEmailSubjectEqual(String expectedSubject)
      Asserts that the email message subject equals the expected string.
      Parameters:
      expectedSubject - expected email subject
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailSubjectContains

      AssertableMailpitResponse seeEmailSubjectContains(String expectedSubString)
      Asserts that the email message subject contains the expected string.
      Parameters:
      expectedSubString - expected substring
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailContainsFrom

      AssertableMailpitResponse seeEmailContainsFrom(String expectedEmail)
      Asserts that the email message contains the expected email address in the "From" field.
      Parameters:
      expectedEmail - expected email address in the "From" field
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailContainsTo

      AssertableMailpitResponse seeEmailContainsTo(String expectedEmail)
      Asserts that the email message contains the expected email address in the "To" field.
      Parameters:
      expectedEmail - expected email address in the "To" field
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailContainsCc

      AssertableMailpitResponse seeEmailContainsCc(String expectedEmail)
      Asserts that the email message contains the expected email address in the "Cc" field.
      Parameters:
      expectedEmail - expected email address in the "Cc" field
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailContainsBcc

      AssertableMailpitResponse seeEmailContainsBcc(String expectedEmail)
      Asserts that the email message contains the expected email address in the "Bcc" field.
      Parameters:
      expectedEmail - expected email address in the "Bcc" field
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailContainsReplyTo

      AssertableMailpitResponse seeEmailContainsReplyTo(String expectedEmail)
      Asserts that the email message contains the expected email address in the "ReplyTo" field.
      Parameters:
      expectedEmail - expected email address in the "ReplyTo" field
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailAttachmentsCountExactly

      AssertableMailpitResponse seeEmailAttachmentsCountExactly(int expectedCount)
      Asserts that the email message contains exactly the expected number of attachments.
      Parameters:
      expectedCount - expected number of attachments
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailToCountExactly

      AssertableMailpitResponse seeEmailToCountExactly(int expectedCount)
      Asserts that the email message contains exactly the expected number of "To" email addresses.
      Parameters:
      expectedCount - expected number of "To" email addresses in the message
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailCcCountExactly

      AssertableMailpitResponse seeEmailCcCountExactly(int expectedCount)
      Asserts that the email message contains exactly the expected number of "Cc" email addresses.
      Parameters:
      expectedCount - expected number of "Cc" email addresses in the message
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailBccCountExactly

      AssertableMailpitResponse seeEmailBccCountExactly(int expectedCount)
      Asserts that the email message contains exactly the expected number of "Bcc" email addresses.
      Parameters:
      expectedCount - expected number of "Bcc" email addresses in the message
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • seeEmailReplyToCountExactly

      AssertableMailpitResponse seeEmailReplyToCountExactly(int expectedCount)
      Asserts that the email message contains exactly the expected number of "ReplyTo" email addresses.
      Parameters:
      expectedCount - expected number of "ReplyTo" email addresses in the message
      Returns:
      this instance for method chaining
      Throws:
      AssertionError - if the assertion fails
    • grabDataFromResponseByPath

      Object grabDataFromResponseByPath(String path)
      Retrieves a field value of any type from the Mailpit response body.
      Parameters:
      path - path to the field (for example: messages[0].To)
      Returns:
      field value from the response body