use of javax.mail.search.RecipientStringTerm in project jodd by oblac.
the class EmailFilterTest method testAndOrNot.
@Test
public void testAndOrNot() {
EmailFilter emailFilter = filter().from("from").to("to").or().not().subject("subject").from("from2");
SearchTerm expected = new OrTerm(new OrTerm(new AndTerm(new FromStringTerm("from"), new RecipientStringTerm(Message.RecipientType.TO, "to")), new NotTerm(new SubjectTerm("subject"))), new FromStringTerm("from2"));
assertEquals(expected, emailFilter.searchTerm);
}
use of javax.mail.search.RecipientStringTerm in project jodd by oblac.
the class EmailFilterTest method testOr2.
@Test
public void testOr2() {
EmailFilter emailFilter = filter().or(filter().from("from"), filter().to("to"));
SearchTerm expected = new OrTerm(new FromStringTerm("from"), new RecipientStringTerm(Message.RecipientType.TO, "to"));
assertEquals(expected, emailFilter.searchTerm);
}
use of javax.mail.search.RecipientStringTerm in project jodd by oblac.
the class EmailFilter method to.
/**
* Defines filter for TO field.
*/
public EmailFilter to(String toAddress) {
SearchTerm toTerm = new RecipientStringTerm(Message.RecipientType.TO, toAddress);
concat(toTerm);
return this;
}
use of javax.mail.search.RecipientStringTerm in project camel by apache.
the class SearchTermBuilder method recipient.
public SearchTermBuilder recipient(Op op, Message.RecipientType type, String pattern) {
SearchTerm st = new RecipientStringTerm(type, pattern);
addTerm(op, st);
return this;
}
Aggregations