use of org.kie.dmn.feel.lang.ast.IfExpressionNode in project drools by kiegroup.
the class FEELParserTest method testIfExpression.
@Test
public void testIfExpression() {
String inputExpression = "if applicant.age < 18 then \"declined\" else \"accepted\"";
BaseNode ifBase = parse(inputExpression);
assertThat(ifBase, is(instanceOf(IfExpressionNode.class)));
assertThat(ifBase.getText(), is(inputExpression));
assertThat(ifBase.getResultType(), is(BuiltInType.STRING));
IfExpressionNode ifExpr = (IfExpressionNode) ifBase;
assertThat(ifExpr.getCondition().getText(), is("applicant.age < 18"));
assertThat(ifExpr.getThenExpression().getText(), is("\"declined\""));
assertThat(ifExpr.getElseExpression().getText(), is("\"accepted\""));
}
Aggregations