builder1.addPackage( packageDescr1 );
if ( builder1.hasErrors() ) {
fail( builder1.getErrors().toString() );
}
final Pattern pattern1 = (Pattern) builder1.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
final PredicateConstraint predicate1 = (PredicateConstraint) pattern1.getConstraints().get( 0 );
final PackageBuilder builder2 = new PackageBuilder();
final PackageDescr packageDescr2 = new PackageDescr( "package2" );
createPredicateRule( packageDescr2,
"eval(x==y)" );
builder2.addPackage( packageDescr2 );
if ( builder2.hasErrors() ) {
fail( builder2.getErrors().toString() );
}
final Pattern pattern2 = (Pattern) builder2.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
final PredicateConstraint predicate2 = (PredicateConstraint) pattern2.getConstraints().get( 0 );
final PackageBuilder builder3 = new PackageBuilder();
if ( builder3.hasErrors() ) {
fail( builder3.getErrors().toString() );
}
final PackageDescr packageDescr3 = new PackageDescr( "package3" );
createPredicateRule( packageDescr3,
"eval(x!=y)" );
builder3.addPackage( packageDescr3 );
final Pattern pattern3 = (Pattern) builder3.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
final PredicateConstraint predicate3 = (PredicateConstraint) pattern3.getConstraints().get( 0 );
assertEquals( predicate1,
predicate2 );
assertFalse( predicate1.equals( predicate3 ) );
assertFalse( predicate2.equals( predicate3 ) );