Class MessagesAssert
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
iterablesFields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallAreFrom(String senderAddress) Verifies that all messages are from the given sender.Verifies that all messages are read.Verifies that all messages are unread.allMessagesSatisfy(Consumer<MessageAssert> assertion) 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.containsMessageWithSubject(String subject) Verifies that the list contains a message with the given subject.element(int index) Returns assertions on a message at the specified index.filteredOnPredicate(Predicate<Message> predicate) 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.filteredOnSubject(String subject) Filters messages by subject and returns a new MessagesAssert.first()Returns assertions on the first message.hasMessageSatisfying(int index, Consumer<MessageAssert> assertion) Applies MessageAssert assertions on a message at the specified index.last()Returns assertions on the last message.protected MessagesAssertnewAbstractIterableAssert(Iterable<? extends Message> iterable) protected MessageAssertMethods 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, zipSatisfyMethods 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, withRepresentationMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.api.Descriptable
as, describedAs
-
Constructor Details
-
MessagesAssert
-
-
Method Details
-
toAssert
- Specified by:
toAssertin classorg.assertj.core.api.AbstractIterableAssert<MessagesAssert,List<Message>, Message, MessageAssert>
-
newAbstractIterableAssert
- Specified by:
newAbstractIterableAssertin classorg.assertj.core.api.AbstractIterableAssert<MessagesAssert,List<Message>, Message, MessageAssert>
-
containsMessageWithSubject
Verifies that the list contains a message with the given subject.- Parameters:
subject- the expected subject- Returns:
- this assertion object
-
containsMessageTo
Verifies that the list contains a message to the given recipient.- Parameters:
recipientAddress- the expected recipient email address- Returns:
- this assertion object
-
containsMessageFrom
Verifies that the list contains a message from the given sender.- Parameters:
senderAddress- the expected sender email address- Returns:
- this assertion object
-
filteredOnSubject
Filters messages by subject and returns a new MessagesAssert.- Parameters:
subject- the subject to filter by- Returns:
- new MessagesAssert with filtered messages
-
filteredOnSender
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
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
Filters messages using a predicate and returns a new MessagesAssert.- Parameters:
predicate- the filter predicate- Returns:
- new MessagesAssert with filtered messages
-
first
Returns assertions on the first message.- Overrides:
firstin classorg.assertj.core.api.AbstractIterableAssert<MessagesAssert,List<Message>, Message, MessageAssert> - Returns:
- MessageAssert for the first message
- Throws:
AssertionError- if the list is empty
-
last
Returns assertions on the last message.- Overrides:
lastin classorg.assertj.core.api.AbstractIterableAssert<MessagesAssert,List<Message>, Message, MessageAssert> - Returns:
- MessageAssert for the last message
- Throws:
AssertionError- if the list is empty
-
element
Returns assertions on a message at the specified index.- Overrides:
elementin classorg.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
Applies MessageAssert assertions on each message.- Parameters:
assertion- the assertion to apply- Returns:
- this assertion object
-
hasMessageSatisfying
Applies MessageAssert assertions on a message at the specified index.- Parameters:
index- the index of the messageassertion- the assertion to apply- Returns:
- this assertion object
- Throws:
AssertionError- if the index is out of bounds
-
allAreFrom
Verifies that all messages are from the given sender.- Parameters:
senderAddress- the expected sender email address- Returns:
- this assertion object
-
allAreUnread
Verifies that all messages are unread.- Returns:
- this assertion object
-
allAreRead
Verifies that all messages are read.- Returns:
- this assertion object
-