use of com.yahoo.elide.core.filter.predicates.LTPredicate in project elide by yahoo.
the class InMemoryFilterExecutorTest method negativeTests.
@Test
public void negativeTests() throws Exception {
author = new Author();
author.setId(10L);
PathElement pathElement = new PathElement(Author.class, Long.class, "id");
expression = new NotFilterExpression(new LTPredicate(pathElement, listEleven));
fn = expression.accept(visitor);
assertFalse(fn.test(author));
expression = new NotFilterExpression(new LEPredicate(pathElement, listTen));
fn = expression.accept(visitor);
assertFalse(fn.test(author));
expression = new NotFilterExpression(new GTPredicate(pathElement, listNine));
fn = expression.accept(visitor);
assertFalse(fn.test(author));
expression = new NotFilterExpression(new GEPredicate(pathElement, listTen));
fn = expression.accept(visitor);
assertFalse(fn.test(author));
expression = new NotFilterExpression(new LTPredicate(pathElement, listTen));
fn = expression.accept(visitor);
assertTrue(fn.test(author));
expression = new NotFilterExpression(new LEPredicate(pathElement, listNine));
fn = expression.accept(visitor);
assertTrue(fn.test(author));
expression = new NotFilterExpression(new GTPredicate(pathElement, listTen));
fn = expression.accept(visitor);
assertTrue(fn.test(author));
expression = new NotFilterExpression(new GEPredicate(pathElement, listEleven));
fn = expression.accept(visitor);
assertTrue(fn.test(author));
}
use of com.yahoo.elide.core.filter.predicates.LTPredicate in project elide by yahoo.
the class InMemoryFilterExecutorTest method compareOpPredicateTests.
@Test
public void compareOpPredicateTests() throws Exception {
author = new Author();
author.setId(10L);
expression = new LTPredicate(authorIdElement, listEleven);
fn = expression.accept(visitor);
assertTrue(fn.test(author));
expression = new LEPredicate(authorIdElement, listTen);
fn = expression.accept(visitor);
assertTrue(fn.test(author));
expression = new GTPredicate(authorIdElement, listNine);
fn = expression.accept(visitor);
assertTrue(fn.test(author));
expression = new GEPredicate(authorIdElement, listTen);
fn = expression.accept(visitor);
assertTrue(fn.test(author));
expression = new LTPredicate(authorIdElement, listTen);
fn = expression.accept(visitor);
assertFalse(fn.test(author));
expression = new LEPredicate(authorIdElement, listNine);
fn = expression.accept(visitor);
assertFalse(fn.test(author));
expression = new GTPredicate(authorIdElement, listTen);
fn = expression.accept(visitor);
assertFalse(fn.test(author));
expression = new GEPredicate(authorIdElement, listEleven);
fn = expression.accept(visitor);
assertFalse(fn.test(author));
// when val is null
author.setId(null);
expression = new LTPredicate(authorIdElement, listTen);
fn = expression.accept(visitor);
assertFalse(fn.test(author));
expression = new LEPredicate(authorIdElement, listTen);
fn = expression.accept(visitor);
assertFalse(fn.test(author));
expression = new GTPredicate(authorIdElement, listTen);
fn = expression.accept(visitor);
assertFalse(fn.test(author));
expression = new GEPredicate(authorIdElement, listTen);
fn = expression.accept(visitor);
assertFalse(fn.test(author));
}
Aggregations