java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
org.assertj.core.api.AbstractIterableAssert<MessagesAssert,List<Message>,Message,MessageAssert>
ch.martinelli.oss.testcontainers.mailpit.assertions.MessagesAssert
All Implemented Interfaces:
org.assertj.core.api.Assert<MessagesAssert,List<Message>>, org.assertj.core.api.Descriptable<MessagesAssert>, org.assertj.core.api.EnumerableAssert<MessagesAssert,Message>, org.assertj.core.api.ExtensionPoints<MessagesAssert,List<Message>>, org.assertj.core.api.ObjectEnumerableAssert<MessagesAssert,Message>

public class MessagesAssert extends org.assertj.core.api.AbstractIterableAssert<MessagesAssert,List<Message>,Message,MessageAssert>
AssertJ assertions for a list of Messages.

Example usage:


 assertThat(messages)
     .hasSize(3)
     .containsMessageWithSubject("Welcome")
     .filteredOnSubject("Newsletter")
     .hasSize(2);
 
  • Field Summary

    Fields inherited from class org.assertj.core.api.AbstractIterableAssert

    iterables

    Fields inherited from class org.assertj.core.api.AbstractAssert

    actual, info, myself, objects, throwUnsupportedExceptionOnEquals
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    allAreFrom(String senderAddress)
    Verifies that all messages are from the given sender.
    Verifies that all messages are read.
    Verifies that all messages are unread.
    Applies MessageAssert assertions on each message.
    containsMessageFrom(String senderAddress)
    Verifies that the list contains a message from the given sender.
    containsMessageTo(String recipientAddress)
    Verifies that the list contains a message to the given recipient.
    Verifies that the list contains a message with the given subject.
    element(int index)
    Returns assertions on a message at the specified index.
    Filters messages using a predicate and returns a new MessagesAssert.
    filteredOnRecipient(String recipientAddress)
    Filters messages by recipient and returns a new MessagesAssert.
    filteredOnSender(String senderAddress)
    Filters messages by sender and returns a new MessagesAssert.
    Filters messages by subject and returns a new MessagesAssert.
    Returns assertions on the first message.
    Applies MessageAssert assertions on a message at the specified index.
    Returns assertions on the last message.
    protected MessagesAssert
     
    protected MessageAssert
    toAssert(Message value, String description)
     

    Methods inherited from class org.assertj.core.api.AbstractIterableAssert

    allMatch, allMatch, allSatisfy, allSatisfy, anyMatch, anyMatch, anySatisfy, anySatisfy, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, as, as, contains, containsAll, containsAnyElementsOf, containsAnyOf, containsAnyOfForProxy, containsExactly, containsExactlyElementsOf, containsExactlyForProxy, containsExactlyInAnyOrder, containsExactlyInAnyOrderElementsOf, containsExactlyInAnyOrderForProxy, containsForProxy, containsNull, containsOnly, containsOnlyElementsOf, containsOnlyForProxy, containsOnlyNulls, containsOnlyOnce, containsOnlyOnceElementsOf, containsOnlyOnceForProxy, containsSequence, containsSequence, containsSequenceForProxy, containsSubsequence, containsSubsequence, containsSubsequenceForProxy, describedAs, describedAs, doesNotContain, doesNotContainAnyElementsOf, doesNotContainForProxy, doesNotContainNull, doesNotContainSequence, doesNotContainSequence, doesNotContainSequenceForProxy, doesNotContainSubsequence, doesNotContainSubsequence, doesNotContainSubsequenceForProxy, doesNotHave, doesNotHaveAnyElementsOfTypes, doesNotHaveDuplicates, doesNotHaveSameClassAs, doNotHave, element, elements, endsWith, endsWith, endsWithForProxy, extracting, extracting, extracting, extracting, extracting, extracting, extractingForProxy, extractingResultOf, extractingResultOf, filteredOn, filteredOn, filteredOn, filteredOn, filteredOn, filteredOnAssertions, filteredOnAssertions, filteredOnNull, first, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtractingForProxy, flatMap, flatMap, flatMap, flatMap, getComparatorsByType, getComparatorsForElementPropertyOrFieldTypes, has, hasAtLeastOneElementOfType, hasExactlyElementsOfTypes, hasOnlyElementsOfType, hasOnlyElementsOfTypes, hasOnlyOneElementSatisfying, hasSameClassAs, hasSameElementsAs, hasSameSizeAs, hasSameSizeAs, hasSize, hasSizeBetween, hasSizeGreaterThan, hasSizeGreaterThanOrEqualTo, hasSizeLessThan, hasSizeLessThanOrEqualTo, hasToString, have, haveAtLeast, haveAtLeastOne, haveAtMost, haveExactly, inBinary, inHexadecimal, is, isEmpty, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEmpty, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNullOrEmpty, isOfAnyClassIn, isSameAs, isSubsetOf, isSubsetOf, isSubsetOfForProxy, last, map, map, map, navigationDescription, newAbstractIterableAssertForProxy, noneMatch, noneMatch, noneSatisfy, noneSatisfy, overridingErrorMessage, satisfiesExactly, satisfiesExactly, satisfiesExactlyForProxy, satisfiesExactlyInAnyOrder, satisfiesExactlyInAnyOrder, satisfiesExactlyInAnyOrderForProxy, satisfiesOnlyOnce, satisfiesOnlyOnce, satisfiesOnlyOnceForProxy, singleElement, singleElement, size, startsWith, startsWithForProxy, usingComparator, usingComparator, usingComparatorForElementFieldsWithNames, usingComparatorForElementFieldsWithType, usingComparatorForType, usingComparisonStrategy, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator, usingElementComparatorIgnoringFields, usingElementComparatorOnFields, usingFieldByFieldElementComparator, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, usingRecursiveFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparatorIgnoringFields, usingRecursiveFieldByFieldElementComparatorOnFields, withFailMessage, withThreadDumpOnError, zipSatisfy

    Methods inherited from class org.assertj.core.api.AbstractAssert

    actual, areEqual, asInstanceOf, asList, assertionError, asString, descriptionText, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, hashCode, hasSameHashCodeAs, hasToString, isElementOfCustomAssert, isInstanceOfSatisfying, isNull, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingEquals, usingEquals, withFailMessage, withRepresentation

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.assertj.core.api.Descriptable

    as, describedAs
  • Constructor Details

    • MessagesAssert

      public MessagesAssert(List<Message> actual)
  • Method Details

    • toAssert

      protected MessageAssert toAssert(Message value, String description)
      Specified by:
      toAssert in class org.assertj.core.api.AbstractIterableAssert<MessagesAssert,List<Message>,Message,MessageAssert>
    • newAbstractIterableAssert

      protected MessagesAssert newAbstractIterableAssert(Iterable<? extends Message> iterable)
      Specified by:
      newAbstractIterableAssert in class org.assertj.core.api.AbstractIterableAssert<MessagesAssert,List<Message>,Message,MessageAssert>
    • containsMessageWithSubject

      public MessagesAssert containsMessageWithSubject(String subject)
      Verifies that the list contains a message with the given subject.
      Parameters:
      subject - the expected subject
      Returns:
      this assertion object
    • containsMessageTo

      public MessagesAssert containsMessageTo(String recipientAddress)
      Verifies that the list contains a message to the given recipient.
      Parameters:
      recipientAddress - the expected recipient email address
      Returns:
      this assertion object
    • containsMessageFrom

      public MessagesAssert containsMessageFrom(String senderAddress)
      Verifies that the list contains a message from the given sender.
      Parameters:
      senderAddress - the expected sender email address
      Returns:
      this assertion object
    • filteredOnSubject

      public MessagesAssert filteredOnSubject(String subject)
      Filters messages by subject and returns a new MessagesAssert.
      Parameters:
      subject - the subject to filter by
      Returns:
      new MessagesAssert with filtered messages
    • filteredOnSender

      public MessagesAssert filteredOnSender(String senderAddress)
      Filters messages by sender and returns a new MessagesAssert.
      Parameters:
      senderAddress - the sender email address to filter by
      Returns:
      new MessagesAssert with filtered messages
    • filteredOnRecipient

      public MessagesAssert filteredOnRecipient(String recipientAddress)
      Filters messages by recipient and returns a new MessagesAssert.
      Parameters:
      recipientAddress - the recipient email address to filter by
      Returns:
      new MessagesAssert with filtered messages
    • filteredOnPredicate

      public MessagesAssert filteredOnPredicate(Predicate<Message> predicate)
      Filters messages using a predicate and returns a new MessagesAssert.
      Parameters:
      predicate - the filter predicate
      Returns:
      new MessagesAssert with filtered messages
    • first

      public MessageAssert first()
      Returns assertions on the first message.
      Overrides:
      first in class org.assertj.core.api.AbstractIterableAssert<MessagesAssert,List<Message>,Message,MessageAssert>
      Returns:
      MessageAssert for the first message
      Throws:
      AssertionError - if the list is empty
    • last

      public MessageAssert last()
      Returns assertions on the last message.
      Overrides:
      last in class org.assertj.core.api.AbstractIterableAssert<MessagesAssert,List<Message>,Message,MessageAssert>
      Returns:
      MessageAssert for the last message
      Throws:
      AssertionError - if the list is empty
    • element

      public MessageAssert element(int index)
      Returns assertions on a message at the specified index.
      Overrides:
      element in class org.assertj.core.api.AbstractIterableAssert<MessagesAssert,List<Message>,Message,MessageAssert>
      Parameters:
      index - the index of the message
      Returns:
      MessageAssert for the message at the index
      Throws:
      AssertionError - if the index is out of bounds
    • allMessagesSatisfy

      public MessagesAssert allMessagesSatisfy(Consumer<MessageAssert> assertion)
      Applies MessageAssert assertions on each message.
      Parameters:
      assertion - the assertion to apply
      Returns:
      this assertion object
    • hasMessageSatisfying

      public MessagesAssert hasMessageSatisfying(int index, Consumer<MessageAssert> assertion)
      Applies MessageAssert assertions on a message at the specified index.
      Parameters:
      index - the index of the message
      assertion - the assertion to apply
      Returns:
      this assertion object
      Throws:
      AssertionError - if the index is out of bounds
    • allAreFrom

      public MessagesAssert allAreFrom(String senderAddress)
      Verifies that all messages are from the given sender.
      Parameters:
      senderAddress - the expected sender email address
      Returns:
      this assertion object
    • allAreUnread

      public MessagesAssert allAreUnread()
      Verifies that all messages are unread.
      Returns:
      this assertion object
    • allAreRead

      public MessagesAssert allAreRead()
      Verifies that all messages are read.
      Returns:
      this assertion object