Class MailpitContainerAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<MailpitContainerAssert,MailpitContainer>
ch.martinelli.oss.testcontainers.mailpit.assertions.MailpitContainerAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<MailpitContainerAssert,,MailpitContainer> org.assertj.core.api.Descriptable<MailpitContainerAssert>,org.assertj.core.api.ExtensionPoints<MailpitContainerAssert,MailpitContainer>
public class MailpitContainerAssert
extends org.assertj.core.api.AbstractAssert<MailpitContainerAssert,MailpitContainer>
AssertJ assertions for
MailpitContainer.
Example usage:
assertThat(mailpitContainer)
.isRunning()
.hasMessages()
.hasMessageCount(1);
assertThat(mailpitContainer)
.withTimeout(Duration.ofSeconds(30))
.awaitMessage()
.withSubject("Welcome")
.isPresent();
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a message awaiter to wait for and assert on messages.awaitMessageCount(int expectedCount) Waits until the mailbox contains exactly the expected number of messages.Waits until the mailbox contains at least one message.Returns assertions on the first message in the mailbox.hasMessageCount(int expectedCount) Verifies that the mailbox contains exactly the expected number of messages.hasMessageFrom(String senderAddress) Verifies that there is a message from the given sender.Verifies that the mailbox contains at least one message.hasMessageTo(String recipientAddress) Verifies that there is a message sent to the given recipient.hasMessageWithSubject(String subject) Verifies that there is a message with the given subject.Verifies that the mailbox is empty.Verifies that the container is running.Returns assertions on the last message in the mailbox.messages()Returns assertions on all messages in the mailbox.withPollInterval(Duration pollInterval) Configures the poll interval for await operations.withTimeout(Duration timeout) Configures the timeout for await operations.Methods inherited from class org.assertj.core.api.AbstractAssert
actual, areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingEquals, usingEquals, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.api.Descriptable
as, as, as, describedAs, describedAs
-
Constructor Details
-
MailpitContainerAssert
-
-
Method Details
-
isRunning
Verifies that the container is running.- Returns:
- this assertion object
-
hasMessages
Verifies that the mailbox contains at least one message.- Returns:
- this assertion object
-
hasNoMessages
Verifies that the mailbox is empty.- Returns:
- this assertion object
-
hasMessageCount
Verifies that the mailbox contains exactly the expected number of messages.- Parameters:
expectedCount- the expected message count- Returns:
- this assertion object
-
withTimeout
Configures the timeout for await operations.- Parameters:
timeout- the maximum time to wait- Returns:
- this assertion object
-
withPollInterval
Configures the poll interval for await operations.- Parameters:
pollInterval- the interval between polls- Returns:
- this assertion object
-
awaitMessage
Creates a message awaiter to wait for and assert on messages.- Returns:
- a new MessageAwaiter for fluent assertions
-
awaitMessages
Waits until the mailbox contains at least one message.- Returns:
- this assertion object
-
awaitMessageCount
Waits until the mailbox contains exactly the expected number of messages.- Parameters:
expectedCount- the expected message count- Returns:
- this assertion object
-
firstMessage
Returns assertions on the first message in the mailbox.- Returns:
- MessageAssert for the first message
- Throws:
AssertionError- if no messages exist
-
lastMessage
Returns assertions on the last message in the mailbox.- Returns:
- MessageAssert for the last message
- Throws:
AssertionError- if no messages exist
-
messages
Returns assertions on all messages in the mailbox.- Returns:
- MessagesAssert for all messages
-
hasMessageWithSubject
Verifies that there is a message with the given subject.- Parameters:
subject- the expected subject- Returns:
- this assertion object
-
hasMessageTo
Verifies that there is a message sent to the given recipient.- Parameters:
recipientAddress- the expected recipient email address- Returns:
- this assertion object
-
hasMessageFrom
Verifies that there is a message from the given sender.- Parameters:
senderAddress- the expected sender email address- Returns:
- this assertion object
-