@Test
public void testQuery() throws Exception {
final PackageBuilder builder = new PackageBuilder();
final PackageDescr packageDescr = new PackageDescr( "p1" );
final QueryDescr queryDescr = new QueryDescr( "query1" );
queryDescr.addParameter( "String",
"$type" );
packageDescr.addRule( queryDescr );
final AndDescr lhs = new AndDescr();
queryDescr.setLhs( lhs );
final PatternDescr pattern = new PatternDescr( Cheese.class.getName(),
"stilton" );
lhs.addDescr( pattern );
pattern.addConstraint( new ExprConstraintDescr("type == $type") );
// Another query, no parameters
QueryDescr queryDescr2 = new QueryDescr( "query2" );
packageDescr.addRule( queryDescr2 );
AndDescr lhs2 = new AndDescr();
queryDescr2.setLhs( lhs2 );
PatternDescr pattern2 = new PatternDescr( Cheese.class.getName() );
lhs2.addDescr( pattern2 );
builder.addPackage( packageDescr );