Search in sources :

Example 1 with FilterExpressionNode

use of org.kie.dmn.feel.lang.ast.FilterExpressionNode in project drools by kiegroup.

the class FEELParserTest method testFilterExpression.

@Test
public void testFilterExpression() {
    String inputExpression = "[ {x:1, y:2}, {x:2, y:3} ][ x=1 ]";
    BaseNode filterBase = parse(inputExpression);
    assertThat(filterBase, is(instanceOf(FilterExpressionNode.class)));
    assertThat(filterBase.getText(), is(inputExpression));
    FilterExpressionNode filter = (FilterExpressionNode) filterBase;
    assertThat(filter.getExpression(), is(instanceOf(ListNode.class)));
    assertThat(filter.getExpression().getText(), is("{x:1, y:2}, {x:2, y:3}"));
    assertThat(filter.getFilter(), is(instanceOf(InfixOpNode.class)));
    assertThat(filter.getFilter().getText(), is("x=1"));
}
Also used : FilterExpressionNode(org.kie.dmn.feel.lang.ast.FilterExpressionNode) BaseNode(org.kie.dmn.feel.lang.ast.BaseNode) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 BaseNode (org.kie.dmn.feel.lang.ast.BaseNode)1 FilterExpressionNode (org.kie.dmn.feel.lang.ast.FilterExpressionNode)1