fr.sii.ogham.helper.email.ExpectedEmailHeader Maven / Gradle / Ivy
package fr.sii.ogham.helper.email;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Class used in tests for ensuring that the email is respected. It provides the
* following information:
*
* - The expected subject
* - The expected sender address
* - The expected recipients (to, cc, bcc)
*
*
* @author Aurélien Baudet
*
*/
public class ExpectedEmailHeader {
/**
* The expected subject
*/
protected String subject;
/**
* The expected sender address
*/
protected String from;
/**
* The expected list of recipients for the "to" field
*/
protected List to = new ArrayList<>();
/**
* The expected list of recipients for the "cc" field
*/
protected List cc = new ArrayList<>();
/**
* The expected list of recipients for the "bcc" field
*/
protected List bcc = new ArrayList<>();
public ExpectedEmailHeader(String subject, String from, String... to) {
this(subject, from, new ArrayList<>(Arrays.asList(to)));
}
public ExpectedEmailHeader(String subject, String from, List to) {
super();
this.subject = subject;
this.from = from;
this.to = to;
}
public String getSubject() {
return subject;
}
public String getFrom() {
return from;
}
public List getTo() {
return to;
}
public List getCc() {
return cc;
}
public List getBcc() {
return bcc;
}
public void setCc(String... cc) {
this.cc = new ArrayList<>(Arrays.asList(cc));
}
public void setBcc(String... bcc) {
this.bcc = new ArrayList<>(Arrays.asList(bcc));
}
}