Methods Summary |
---|
private void | setNotice(java.lang.String notice)
this.notice = notice;
|
private void | setProcessor(java.lang.String processor)
this.processor = processor;
|
private void | setupMailet()
mailet = new ToProcessor();
MockMailetConfig mci = new MockMailetConfig("Test",
new MockMailContext());
if (processor != null) {
mci.setProperty("processor", processor);
}
if (notice != null) {
mci.setProperty("notice", notice);
}
mailet.init(mci);
|
private void | setupMockedMail(javax.mail.internet.MimeMessage m)
mockedMail = new MockMail();
mockedMail.setMessage(m);
mockedMail.setRecipients(Arrays.asList(new MailAddress[] {
new MailAddress("test@james.apache.org"),
new MailAddress("test2@james.apache.org") }));
|
public void | testExceptionThrown()
boolean exceptionThrown = false;
setProcessor(null);
setNotice("error in message");
setupMockedMail(mockedMimeMessage);
try {
setupMailet();
mailet.service(mockedMail);
} catch (MessagingException m) {
exceptionThrown = true;
}
assertTrue(exceptionThrown);
|
public void | testValidToProcessor()
setProcessor("error");
setNotice("error in message");
setupMockedMail(mockedMimeMessage);
setupMailet();
mailet.service(mockedMail);
assertEquals(processor, mockedMail.getState());
assertEquals(notice, mockedMail.getErrorMessage());
|