Package io.quarkiverse.mailpit.test
Class Mailbox
- java.lang.Object
-
- io.quarkiverse.mailpit.test.Mailbox
-
public class Mailbox extends Object
Injected MailContext wrapping the API to Mailpit for unit testing.
-
-
Constructor Summary
Constructors Constructor Description Mailbox()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Delete all messages.ApiClientcreateApiClient()com.fasterxml.jackson.databind.ObjectMappercreateDefaultObjectMapper()Create the JSON Mapper with some defaults and custom LocalDateTime parsing.voiddelete(String ID)Delete a single message.List<Message>find(String query, Integer start, Integer limit)Search messages.MessagefindFirst(String query)Search messages.ApiClientgetApiClient()ApplicationApigetApplicationApi()AppInformationgetApplicationInfo()Get application information Returns basic runtime information, message totals and latest release version.StringgetMailApiUrl()Use "mailpit.http.server" to get the running Mailpit API Server.MessageApigetMessageApi()MessagesApigetMessagesApi()
-
-
-
Method Detail
-
delete
public void delete(String ID) throws ApiException
Delete a single message.- Parameters:
ID- Database ID to delete- Throws:
ApiException- if fails to make API call
-
clear
public void clear() throws ApiExceptionDelete all messages.- Throws:
ApiException- if fails to make API call
-
find
public List<Message> find(String query, Integer start, Integer limit) throws ApiException
Search messages. Returns the latest messages matching a search.- Parameters:
query- Search query (required)start- Pagination offset (optional, default to 0)limit- Limit results (optional, default to 50)- Returns:
- List
- Throws:
ApiException- if fails to make API call
-
findFirst
public Message findFirst(String query) throws ApiException
Search messages. Returns the first message matching a search.- Parameters:
query- Search query (required)- Returns:
- Message
- Throws:
ApiException- if fails to make API call
-
getApplicationInfo
public AppInformation getApplicationInfo() throws ApiException
Get application information Returns basic runtime information, message totals and latest release version.- Returns:
- AppInformation
- Throws:
ApiException- if fails to make API call
-
getApiClient
public ApiClient getApiClient()
-
getApplicationApi
public ApplicationApi getApplicationApi()
-
getMessagesApi
public MessagesApi getMessagesApi()
-
getMessageApi
public MessageApi getMessageApi()
-
createApiClient
public ApiClient createApiClient()
-
getMailApiUrl
public String getMailApiUrl()
Use "mailpit.http.server" to get the running Mailpit API Server.- Returns:
- the mailer URL or an exception if not found
-
createDefaultObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper createDefaultObjectMapper()
Create the JSON Mapper with some defaults and custom LocalDateTime parsing.- Returns:
- the
ObjectMapper
-
-