final PackageDescr packageDescr1 = new PackageDescr( "package1" );
createReturnValueRule( packageDescr1,
" x + y " );
builder1.addPackage( packageDescr1 );
final Pattern pattern1 = (Pattern) builder1.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
final ReturnValueConstraint returnValue1 = (ReturnValueConstraint) pattern1.getConstraints().get( 2 );
final PackageBuilder builder2 = new PackageBuilder();
final PackageDescr packageDescr2 = new PackageDescr( "package2" );
createReturnValueRule( packageDescr2,
" x + y " );
builder2.addPackage( packageDescr2 );
final Pattern pattern2 = (Pattern) builder2.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
final ReturnValueConstraint returnValue2 = (ReturnValueConstraint) pattern2.getConstraints().get( 2 );
final PackageBuilder builder3 = new PackageBuilder();
final PackageDescr packageDescr3 = new PackageDescr( "package3" );
createReturnValueRule( packageDescr3,
" x - y " );
builder3.addPackage( packageDescr3 );
final Pattern pattern3 = (Pattern) builder3.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
final ReturnValueConstraint returnValue3 = (ReturnValueConstraint) pattern3.getConstraints().get( 2 );
assertEquals( returnValue1,
returnValue2 );
assertFalse( returnValue1.equals( returnValue3 ) );
assertFalse( returnValue2.equals( returnValue3 ) );