Methods Summary |
---|
private void | setRecipients(org.apache.mailet.MailAddress[] recipients)
this.recipients = recipients;
|
private void | setupMatcher()
matcher = new IsSingleRecipient();
MockMatcherConfig mci = new MockMatcherConfig("IsSingleRecipient",
new MockMailContext());
matcher.init(mci);
|
private void | setupMockedMail(javax.mail.internet.MimeMessage m)
mockedMail = new MockMail();
mockedMail.setMessage(m);
mockedMail.setRecipients(Arrays.asList(recipients));
|
private void | setupMockedMimeMessage()
String sender = "test@james.apache.org";
String rcpt = "test2@james.apache.org";
mockedMimeMessage = new MockMimeMessage();
mockedMimeMessage.setFrom(new InternetAddress(sender));
mockedMimeMessage.setRecipients(RecipientType.TO, rcpt);
mockedMimeMessage.setSubject("testmail");
mockedMimeMessage.setText("testtext");
mockedMimeMessage.saveChanges();
|
public void | testHostIsMatchedAllRecipients()
setRecipients(new MailAddress[] { new MailAddress(
"test@james.apache.org") });
setupMockedMimeMessage();
setupMockedMail(mockedMimeMessage);
setupMatcher();
Collection matchedRecipients = matcher.match(mockedMail);
assertNotNull(matchedRecipients);
|
public void | testHostIsMatchedOneRecipient()
setRecipients(new MailAddress[] {
new MailAddress("test@james2.apache.org"),
new MailAddress("test2@james.apache.org") });
setupMockedMimeMessage();
setupMockedMail(mockedMimeMessage);
setupMatcher();
Collection matchedRecipients = matcher.match(mockedMail);
assertNull(matchedRecipients);
|