use of javax.mail.search.FromStringTerm in project jodd by oblac.
the class EmailFilterTest method testAnd1.
@Test
public void testAnd1() {
EmailFilter emailFilter = filter().from("from");
SearchTerm expected = new FromStringTerm("from");
assertEquals(expected, emailFilter.searchTerm);
}
use of javax.mail.search.FromStringTerm in project jodd by oblac.
the class EmailFilter method from.
/**
* Defines filter for FROM field.
*/
public EmailFilter from(String fromAddress) {
SearchTerm fromTerm = new FromStringTerm(fromAddress);
concat(fromTerm);
return this;
}
use of javax.mail.search.FromStringTerm in project jodd by oblac.
the class EmailFilterTest method testAnd2.
@Test
public void testAnd2() {
EmailFilter emailFilter = filter().from("from").to("to");
SearchTerm expected = new AndTerm(new FromStringTerm("from"), new RecipientStringTerm(Message.RecipientType.TO, "to"));
assertEquals(expected, emailFilter.searchTerm);
}
use of javax.mail.search.FromStringTerm in project jodd by oblac.
the class EmailFilterTest method testAndOrNotAlt.
@Test
public void testAndOrNotAlt() {
EmailFilter emailFilter = filter().or(filter().and(filter().from("from"), filter().to("to")), filter().not(filter().subject("subject")), filter().from("from2"));
SearchTerm expected = new OrTerm(new SearchTerm[] { 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.FromStringTerm in project jodd by oblac.
the class EmailFilterTest method testOr2Alt.
@Test
public void testOr2Alt() {
EmailFilter emailFilter = filter().or().from("from").to("to");
SearchTerm expected = new OrTerm(new FromStringTerm("from"), new RecipientStringTerm(Message.RecipientType.TO, "to"));
assertEquals(expected, emailFilter.searchTerm);
}
Aggregations