use of com.linkedin.data.it.NotPredicate in project rest.li by linkedin.
the class TestPredicateExpressionParser method testNotNotOr.
@Test
public void testNotNotOr() {
final Predicate parsed = PredicateExpressionParser.parse("!!com.linkedin.data.it.AlwaysTruePredicate | com.linkedin.data.it.AlwaysFalsePredicate");
Assert.assertEquals(parsed.getClass(), OrPredicate.class);
final List<Predicate> orChildren = ((OrPredicate) parsed).getChildPredicates();
Assert.assertEquals(orChildren.get(0).getClass(), NotPredicate.class);
Assert.assertEquals(orChildren.get(1).getClass(), AlwaysFalsePredicate.class);
final Predicate notChild1 = ((NotPredicate) orChildren.get(0)).getChildPredicate();
Assert.assertEquals(notChild1.getClass(), NotPredicate.class);
final Predicate notChild2 = ((NotPredicate) notChild1).getChildPredicate();
Assert.assertEquals(notChild2.getClass(), AlwaysTruePredicate.class);
}
use of com.linkedin.data.it.NotPredicate in project rest.li by linkedin.
the class TestPredicateExpressionParser method testNotNotAnd.
@Test
public void testNotNotAnd() {
final Predicate parsed = PredicateExpressionParser.parse("!!com.linkedin.data.it.AlwaysTruePredicate & com.linkedin.data.it.AlwaysFalsePredicate");
Assert.assertEquals(parsed.getClass(), AndPredicate.class);
final List<Predicate> andChildren = ((AndPredicate) parsed).getChildPredicates();
Assert.assertEquals(andChildren.get(0).getClass(), NotPredicate.class);
Assert.assertEquals(andChildren.get(1).getClass(), AlwaysFalsePredicate.class);
final Predicate notChild1 = ((NotPredicate) andChildren.get(0)).getChildPredicate();
Assert.assertEquals(notChild1.getClass(), NotPredicate.class);
final Predicate notChild2 = ((NotPredicate) notChild1).getChildPredicate();
Assert.assertEquals(notChild2.getClass(), AlwaysTruePredicate.class);
}
use of com.linkedin.data.it.NotPredicate in project rest.li by linkedin.
the class TestPredicateExpressionParser method testNotParenAnd.
@Test
public void testNotParenAnd() {
final Predicate parsed = PredicateExpressionParser.parse("!(com.linkedin.data.it.AlwaysTruePredicate & com.linkedin.data.it.AlwaysFalsePredicate)");
Assert.assertEquals(parsed.getClass(), NotPredicate.class);
final Predicate intermediate = ((NotPredicate) parsed).getChildPredicate();
Assert.assertEquals(intermediate.getClass(), AndPredicate.class);
final List<Predicate> children = ((AndPredicate) intermediate).getChildPredicates();
Assert.assertEquals(children.get(0).getClass(), AlwaysTruePredicate.class);
Assert.assertEquals(children.get(1).getClass(), AlwaysFalsePredicate.class);
}
use of com.linkedin.data.it.NotPredicate in project rest.li by linkedin.
the class TestPredicateExpressionParser method testNotParen.
@Test
public void testNotParen() {
final Predicate parsed = PredicateExpressionParser.parse("!(com.linkedin.data.it.AlwaysTruePredicate)");
Assert.assertEquals(parsed.getClass(), NotPredicate.class);
Assert.assertEquals(((NotPredicate) parsed).getChildPredicate().getClass(), AlwaysTruePredicate.class);
}
use of com.linkedin.data.it.NotPredicate in project rest.li by linkedin.
the class TestPredicateExpressionParser method testDoubleNot.
@Test
public void testDoubleNot() {
final Predicate parsed = PredicateExpressionParser.parse("!!com.linkedin.data.it.AlwaysTruePredicate");
Assert.assertEquals(parsed.getClass(), NotPredicate.class);
final Predicate intermediate1 = ((NotPredicate) parsed).getChildPredicate();
Assert.assertEquals(intermediate1.getClass(), NotPredicate.class);
final Predicate intermediate2 = ((NotPredicate) intermediate1).getChildPredicate();
Assert.assertEquals(intermediate2.getClass(), AlwaysTruePredicate.class);
}
Aggregations