use of org.kie.dmn.feel.lang.ast.IterationContextNode in project drools by kiegroup.
the class FEELParserTest method testForExpression.
@Test
public void testForExpression() {
String inputExpression = "for item in order.items return item.price * item.quantity";
BaseNode forbase = parse(inputExpression);
assertThat(forbase, is(instanceOf(ForExpressionNode.class)));
assertThat(forbase.getText(), is(inputExpression));
assertThat(forbase.getResultType(), is(BuiltInType.LIST));
ForExpressionNode forExpr = (ForExpressionNode) forbase;
assertThat(forExpr.getIterationContexts().size(), is(1));
assertThat(forExpr.getExpression(), is(instanceOf(InfixOpNode.class)));
assertThat(forExpr.getExpression().getText(), is("item.price * item.quantity"));
IterationContextNode ic = forExpr.getIterationContexts().get(0);
assertThat(ic.getName().getText(), is("item"));
assertThat(ic.getExpression(), is(instanceOf(QualifiedNameNode.class)));
assertThat(ic.getExpression().getText(), is("order.items"));
}
Aggregations