OLINGO-1245: allow to define a full boolean expression with surrounding 'not' logical operator with parens surrounding the boolean expression

This commit is contained in:
Ramesh Reddy 2018-08-03 11:07:08 -05:00
parent e18c6fa184
commit 243708f168
2 changed files with 3 additions and 1 deletions

View File

@ -313,7 +313,7 @@ public class ExpressionParser {
}
return new UnaryImpl(UnaryOperatorKind.MINUS, expression, getType(expression));
} else if (tokenizer.next(TokenKind.NotOperator)) {
final Expression expression = parseExprPrimary();
final Expression expression = parseExprValue();
checkType(expression, EdmPrimitiveTypeKind.Boolean);
checkNoCollection(expression);
return new UnaryImpl(UnaryOperatorKind.NOT, expression, getType(expression));

View File

@ -171,7 +171,9 @@ public class ExpressionParserTest {
@Test
public void filterUnaryOperators() throws Exception {
testFilter.runOnETAllPrim("not PropertyBoolean").is("<not <PropertyBoolean>>");
testFilter.runOnETAllPrim("not (PropertyBoolean)").is("<not <PropertyBoolean>>");
testFilter.runOnETAllPrim("-PropertyInt16 eq PropertyInt16").is("<<- <PropertyInt16>> eq <PropertyInt16>>");
testFilter.runOnETAllPrim("not (PropertyString eq null)").is("<not <<PropertyString> eq <null>>>");
}
@Test