Search in sources :

Example 1 with NotNullPredicate

use of com.yahoo.elide.core.filter.predicates.NotNullPredicate in project elide by yahoo.

the class InMemoryFilterExecutorTest method isnullAndNotnullPredicateTest.

@Test
public void isnullAndNotnullPredicateTest() throws Exception {
    author = new Author();
    author.setId(1L);
    author.setName("AuthorForTest");
    // When name is not null
    expression = new IsNullPredicate(authorNameElement);
    fn = expression.accept(visitor);
    assertFalse(fn.test(author));
    expression = new NotNullPredicate(authorNameElement);
    fn = expression.accept(visitor);
    assertTrue(fn.test(author));
    // When name is null
    author.setName(null);
    expression = new IsNullPredicate(authorNameElement);
    fn = expression.accept(visitor);
    assertTrue(fn.test(author));
    expression = new NotNullPredicate(authorNameElement);
    fn = expression.accept(visitor);
    assertFalse(fn.test(author));
}
Also used : Author(example.Author) IsNullPredicate(com.yahoo.elide.core.filter.predicates.IsNullPredicate) NotNullPredicate(com.yahoo.elide.core.filter.predicates.NotNullPredicate) Test(org.junit.jupiter.api.Test)

Aggregations

IsNullPredicate (com.yahoo.elide.core.filter.predicates.IsNullPredicate)1 NotNullPredicate (com.yahoo.elide.core.filter.predicates.NotNullPredicate)1 Author (example.Author)1 Test (org.junit.jupiter.api.Test)1