fr.sii.ogham.helper.email.ExpectedEmail Maven / Gradle / Ivy
package fr.sii.ogham.helper.email;
/**
* Class used in tests for ensuring that the email is respected. It provides the
* following information:
*
* - The expected subject
* - The expected body
* - The expected sender address
* - The expected recipients (to, cc, bcc)
*
*
* @author Aurélien Baudet
* @see ExpectedEmailHeader
*/
public class ExpectedEmail extends ExpectedEmailHeader {
/**
* The expected body content
*/
private ExpectedContent expectedContent;
/**
* Initialize the expected email with string values. The body is used as-is
* and is expected to provide a "plain/text" Mime Type.
*
* @param subject
* the expected subject of the email
* @param body
* the expected body of the email in plain text
* @param from
* the expected email sender address
* @param to
* the expected recipients
*/
public ExpectedEmail(String subject, String body, String from, String... to) {
this(subject, new ExpectedContent(body, "text/plain.*"), from, to);
}
/**
* Initialize the expected email with provided values.
*
* @param subject
* the expected subject of the email
* @param expectedContent
* the expected body of the email with the expected Mime Type
* @param from
* the expected email sender address
* @param to
* the expected recipients
*/
public ExpectedEmail(String subject, ExpectedContent expectedContent, String from, String... to) {
super(subject, from, to);
this.expectedContent = expectedContent;
}
public ExpectedContent getExpectedContent() {
return expectedContent;
}
}