use of org.graylog.plugins.pipelineprocessor.ast.expressions.EqualityExpression in project graylog2-server by Graylog2.
the class PrecedenceTest method comparisonVsEqual.
@Test
public void comparisonVsEqual() {
final Rule rule = parseRule("rule \"test\" when 1 > 2 == false then end");
final LogicalExpression when = rule.when();
assertThat(when).isInstanceOf(EqualityExpression.class);
EqualityExpression topEqual = (EqualityExpression) when;
assertThat(topEqual.left()).isInstanceOf(ComparisonExpression.class);
assertThat(topEqual.right()).isInstanceOf(BooleanExpression.class);
}
use of org.graylog.plugins.pipelineprocessor.ast.expressions.EqualityExpression in project graylog2-server by Graylog2.
the class PrecedenceTest method parenGroup.
@Test
public void parenGroup() {
final Rule rule = parseRule("rule \"test\" when true == (false == false) then end");
final LogicalExpression when = rule.when();
assertThat(when).isInstanceOf(EqualityExpression.class);
EqualityExpression topEqual = (EqualityExpression) when;
assertThat(topEqual.left()).isInstanceOf(BooleanExpression.class);
assertThat(topEqual.right()).isInstanceOf(EqualityExpression.class);
final BooleanExpression trueExpr = (BooleanExpression) topEqual.left();
assertThat(trueExpr.evaluateBool(null)).isTrue();
final EqualityExpression falseFalse = (EqualityExpression) topEqual.right();
assertThat(falseFalse.evaluateBool(null)).isTrue();
}
Aggregations