@Test
public void testFunctionDefinition() {

    String inputExpression = "{ is minor : function( person's age ) person's age < 21 }";
    BaseNode ctxbase = parse( inputExpression );
    assertThat( ctxbase, is( instanceOf( ContextNode.class ) ) );
    assertThat( ctxbase.getText(), is( inputExpression ) );
    ContextNode ctx = (ContextNode) ctxbase;
    assertThat( ctx.getEntries().size(), is( 1 ) );
    ContextEntryNode entry = ctx.getEntries().get( 0 );
    assertThat( entry.getName(), is( instanceOf( NameDefNode.class ) ) );
    NameDefNode name = (NameDefNode) entry.getName();
    assertThat( name.getText(), is("is minor") );
    assertThat( entry.getValue(), is( instanceOf( FunctionDefNode.class ) ) );
    assertThat( entry.getValue().getText(), is("function( person's age ) person's age < 21") );
    FunctionDefNode isMinorFunc = (FunctionDefNode) entry.getValue();
    assertThat( isMinorFunc.getFormalParameters().size(), is( 1 ) );
    assertThat( isMinorFunc.getFormalParameters().get( 0 ).getText(), is( "person's age" ) );
    assertThat( isMinorFunc.isExternal(), is( false ) );
    assertThat( isMinorFunc.getBody(), is( instanceOf( InfixOpNode.class ) ) );
}