// examine the first pattern
FactPattern person = (FactPattern) rm.lhs[0];
assertEquals( 3,
person.constraintList.constraints.length );
SingleFieldConstraint cons = (SingleFieldConstraint) person.constraintList.constraints[0];
assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
cons.getConstraintValueType() );
assertEquals( "name",
cons.getFieldName() );
assertEquals( "==",
cons.getOperator() );
assertEquals( "mike",
cons.getValue() );
cons = (SingleFieldConstraint) person.constraintList.constraints[1];
assertEquals( BaseSingleFieldConstraint.TYPE_RET_VALUE,
cons.getConstraintValueType() );
assertEquals( "age",
cons.getFieldName() );
assertEquals( "<",
cons.getOperator() );
assertEquals( "33 + 1",
cons.getValue() );
cons = (SingleFieldConstraint) person.constraintList.constraints[2];
assertEquals( BaseSingleFieldConstraint.TYPE_PREDICATE,
cons.getConstraintValueType() );
assertEquals( "age > 6",
cons.getValue() );
assertEquals( person.isNegated(),
true );
assertTrue( drl.indexOf( "not Person(" ) > 0 );
// examine the second pattern
FactPattern cheese = (FactPattern) rm.lhs[1];
assertEquals( 1,
cheese.constraintList.constraints.length );
cons = (SingleFieldConstraint) cheese.constraintList.constraints[0];
assertEquals( "type",
cons.getFieldName() );
assertEquals( "==",
cons.getOperator() );
assertEquals( "stilton",
cons.getValue() );
assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
cons.getConstraintValueType() );
assertEquals( cheese.isNegated(),
false );
assertTrue( drl.indexOf( "c : Cheese(" ) > 0 );