}
@Test
public void testBindingCompositeWithMethods() throws Exception {
final String text = "rule X when Person( $name : name.toUpperCase() == \"Bob\" || $loc : location[0].city == \"Montreal\" ) then end";
PatternDescr pattern = (PatternDescr) ((RuleDescr) parse( "rule",
text )).getLhs().getDescrs().get( 0 );
assertEquals( "Person",
pattern.getObjectType() );
assertFalse( pattern.isUnification() );
// assertEquals( 2,
// pattern.getDescrs().size() );
// BindingDescr bindingDescr = pattern.getDescrs().get( 0 );
// assertEquals( "$name",
// bindingDescr.getVariable() );
// assertEquals( "name.toUpperCase()",
// bindingDescr.getExpression() );
// assertFalse( bindingDescr.isUnification() );
//
// bindingDescr = pattern.getDescrs().get( 1 );
// assertEquals( "$loc",
// bindingDescr.getVariable() );
// assertEquals( "location[0].city",
// bindingDescr.getExpression() );
// assertFalse( bindingDescr.isUnification() );
// embedded bindings are extracted at compile time
List< ? > constraints = pattern.getDescrs();
assertEquals( 1,
constraints.size() );
assertEquals( "$name : name.toUpperCase() == \"Bob\" || $loc : location[0].city == \"Montreal\"",
((ExprConstraintDescr) constraints.get( 0 )).getExpression() );
}