@Test
public void testNestedContexts() {

    String inputExpression = "{ a value : 10,"
                   + " an applicant : { "
                   + "    first name : \"Edson\", "
                   + "    last + name : \"Tirelli\", "
                   + "    full name : first name + last + name, "
                   + "    address : {"
                   + "        street : \"55 broadway st\","
                   + "        city : \"New York\" "
                   + "    }, "
                   + "    xxx: last + name"
                   + " } "
                   + "}";
    BaseNode ctxbase = parse( inputExpression );
    assertThat( ctxbase, is( instanceOf( ContextNode.class ) ) );
    assertThat( ctxbase.getText(), is( inputExpression ) );
    ContextNode ctx = (ContextNode) ctxbase;
    assertThat( ctx.getEntries().size(), is( 2 ) );
    ContextEntryNode entry = ctx.getEntries().get( 0 );
    assertThat( entry.getName(), is( instanceOf( NameDefNode.class ) ) );
    NameDefNode name = (NameDefNode) entry.getName();
    assertThat( name.getText(), is("a value") );
    assertThat( entry.getValue(), is( instanceOf( NumberNode.class ) ) );
    assertThat( entry.getResultType(), is( BuiltInType.NUMBER ) );
    assertThat( entry.getValue().getText(), is("10") );
    entry = ctx.getEntries().get( 1 );
    assertThat( entry.getName(), is( instanceOf( NameDefNode.class ) ) );
    name = (NameDefNode) entry.getName();
    assertThat( name.getText(), is( "an applicant" ) );
    assertThat( entry.getValue(), is( instanceOf( ContextNode.class ) ) );
    ContextNode applicant = (ContextNode) entry.getValue();
    assertThat( applicant.getEntries().size(), is( 5 ) );
    assertThat( applicant.getEntries().get( 0 ).getName().getText(), is("first name") );
    assertThat( applicant.getEntries().get( 0 ).getResultType(), is( BuiltInType.STRING ) );
    assertThat( applicant.getEntries().get( 1 ).getName().getText(), is("last + name") );
    assertThat( applicant.getEntries().get( 1 ).getResultType(), is( BuiltInType.STRING ) );
    assertThat( applicant.getEntries().get( 2 ).getName().getText(), is("full name") );
    assertThat( applicant.getEntries().get( 2 ).getResultType(), is( BuiltInType.STRING ) );
    assertThat( applicant.getEntries().get( 3 ).getName().getText(), is("address") );
    assertThat( applicant.getEntries().get( 3 ).getValue(), is( instanceOf( ContextNode.class ) ) );
    ContextNode address = (ContextNode) applicant.getEntries().get( 3 ).getValue();
    assertThat( address.getEntries().size(), is( 2 ) );
    assertThat( address.getEntries().get( 0 ).getName().getText(), is("street") );
    assertThat( address.getEntries().get( 0 ).getResultType(), is( BuiltInType.STRING ) );
    assertThat( address.getEntries().get( 1 ).getName().getText(), is("city") );
    assertThat( address.getEntries().get( 0 ).getResultType(), is( BuiltInType.STRING ) );
}