PatternDescr patternDescr = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
assertEquals( "$r",
patternDescr.getIdentifier() );
assertEquals( 4,
patternDescr.getDescrs().size() );
FieldBindingDescr nameBind = (FieldBindingDescr) patternDescr.getDescrs().get( 0 );
assertEquals( "$n", nameBind.getIdentifier() );
assertEquals( "name", nameBind.getFieldName() );
FieldConstraintDescr fieldConstraintDescr = (FieldConstraintDescr) patternDescr.getDescrs().get( 1 );
assertEquals( "name",
fieldConstraintDescr.getFieldName() );
assertEquals( 1,
fieldConstraintDescr.getRestriction().getRestrictions().size() );
LiteralRestrictionDescr literalRestrictionDescr = (LiteralRestrictionDescr) fieldConstraintDescr.getRestriction().getRestrictions().get( 0 );
assertEquals( "==",
literalRestrictionDescr.getEvaluator() );
assertEquals( "Bob",
literalRestrictionDescr.getText() );
FieldBindingDescr ageBind = (FieldBindingDescr) patternDescr.getDescrs().get( 2 );
assertEquals( "$a", ageBind.getIdentifier() );
assertEquals( "age", ageBind.getFieldName() );
fieldConstraintDescr = (FieldConstraintDescr) patternDescr.getDescrs().get( 3 );
assertEquals( "age",
fieldConstraintDescr.getFieldName() );
assertEquals( 1,
fieldConstraintDescr.getRestriction().getRestrictions().size() );