Search in sources :

Example 1 with GTPredicate

use of com.yahoo.elide.core.filter.predicates.GTPredicate 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));
}
Also used : PathElement(com.yahoo.elide.core.Path.PathElement) GTPredicate(com.yahoo.elide.core.filter.predicates.GTPredicate) LEPredicate(com.yahoo.elide.core.filter.predicates.LEPredicate) GEPredicate(com.yahoo.elide.core.filter.predicates.GEPredicate) Author(example.Author) LTPredicate(com.yahoo.elide.core.filter.predicates.LTPredicate) Test(org.junit.jupiter.api.Test)

Example 2 with GTPredicate

use of com.yahoo.elide.core.filter.predicates.GTPredicate 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));
}
Also used : GTPredicate(com.yahoo.elide.core.filter.predicates.GTPredicate) LEPredicate(com.yahoo.elide.core.filter.predicates.LEPredicate) GEPredicate(com.yahoo.elide.core.filter.predicates.GEPredicate) Author(example.Author) LTPredicate(com.yahoo.elide.core.filter.predicates.LTPredicate) Test(org.junit.jupiter.api.Test)

Aggregations

GEPredicate (com.yahoo.elide.core.filter.predicates.GEPredicate)2 GTPredicate (com.yahoo.elide.core.filter.predicates.GTPredicate)2 LEPredicate (com.yahoo.elide.core.filter.predicates.LEPredicate)2 LTPredicate (com.yahoo.elide.core.filter.predicates.LTPredicate)2 Author (example.Author)2 Test (org.junit.jupiter.api.Test)2 PathElement (com.yahoo.elide.core.Path.PathElement)1