lhs.getDescrs().size() );
// System.err.println( lhs.getDescrs() );
// Check first pattern
final PatternDescr first = (PatternDescr) lhs.getDescrs().get( 0 );
assertEquals( "foo3",
first.getIdentifier() );
assertEquals( "Bar",
first.getObjectType() );
assertEquals( 1,
first.getConstraint().getDescrs().size() );
// LiteralDescr constraint = (LiteralDescr) first.getDescrs().get( 0 );
AndDescr and = (AndDescr) first.getConstraint();
ExprConstraintDescr fld = (ExprConstraintDescr) and.getDescrs().get( 0 );
assertNotNull( fld );
assertEquals( "a==3",
fld.getExpression() );
// Check second pattern
final PatternDescr second = (PatternDescr) lhs.getDescrs().get( 1 );
assertEquals( "foo4",
second.getIdentifier() );
assertEquals( "Bar",
second.getObjectType() );
assertEquals( 1,
second.getDescrs().size() );
final ExprConstraintDescr fieldBindingDescr = (ExprConstraintDescr) second.getDescrs().get( 0 );
assertEquals( "a4:a==4",
fieldBindingDescr.getExpression() );
// Check third pattern
final PatternDescr third = (PatternDescr) lhs.getDescrs().get( 2 );
assertNull( third.getIdentifier() );
assertEquals( "Baz",
third.getObjectType() );
assertEqualsIgnoreWhitespace( "if ( a == b ) { " + " assert( foo3 );" + "} else {" + " retract( foo4 );" + "}" + " System.out.println( a4 );",
(String) rule.getConsequence() );
}