use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class BetweenVisitorTest method whenPredicateIsNotGreaterLessPredicate_thenIsNotUsedToBuildBetween.
@Test
public void whenPredicateIsNotGreaterLessPredicate_thenIsNotUsedToBuildBetween() {
Predicate left = equal("attribute", 5);
Predicate right = lessEqual("attribute", 6);
Predicate and = and(left, right);
Predicate result = visitor.visit((AndPredicate) and, mockIndexes);
assertSame(and, result);
}
use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class BetweenVisitorTest method whenOnlyOneSideFound_thenReturnOriginalPredicate.
@Test
public void whenOnlyOneSideFound_thenReturnOriginalPredicate() {
Predicate p1 = greaterEqual("attribute1", 5);
Predicate p2 = lessEqual("attribute2", 6);
Predicate and = and(p1, p2);
Predicate result = visitor.visit((AndPredicate) and, mockIndexes);
assertSame(and, result);
}
use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class BetweenVisitorTest method whenPredicatesOutsideTheRangeFromRightExist_thenEliminateThem.
@Test
public void whenPredicatesOutsideTheRangeFromRightExist_thenEliminateThem() {
//(age >= 5 and age <= 6 and age < 10) --> (age between 5 6)
Predicate left = greaterEqual("attribute", 5);
Predicate right = lessEqual("attribute", 6);
Predicate other = lessEqual("attribute", 10);
Predicate and = and(left, right, other);
Predicate result = visitor.visit((AndPredicate) and, mockIndexes);
assertBetweenPredicate(result, 5, 6);
}
use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class BetweenVisitorTest method whenNoConverterExist_thenReturnOriginalPredicate.
@Test
public void whenNoConverterExist_thenReturnOriginalPredicate() {
disableConverter();
Predicate left = greaterEqual("attribute", 5);
Predicate right = lessEqual("attribute", 6);
Predicate and = and(left, right);
Predicate result = visitor.visit((AndPredicate) and, mockIndexes);
assertSame(and, result);
}
use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class BetweenVisitorTest method whenSideAreOverlapping_thenReturnFalsePredicate.
@Test
public void whenSideAreOverlapping_thenReturnFalsePredicate() {
Predicate p1 = greaterEqual("attribute1", 5);
Predicate p2 = lessEqual("attribute1", 4);
Predicate and = and(p1, p2);
Predicate result = visitor.visit((AndPredicate) and, mockIndexes);
assertEquals(FalsePredicate.INSTANCE, result);
}
Aggregations