use of org.drools.drl.ast.descr.ForallDescr in project drools by kiegroup.
the class RuleParserTest method testForall.
@Test
public void testForall() throws Exception {
final PackageDescr pkg = (PackageDescr) parseResource("compilationUnit", "forall.drl");
assertEquals(1, pkg.getRules().size());
final RuleDescr rule = (RuleDescr) pkg.getRules().get(0);
assertEquals(1, rule.getLhs().getDescrs().size());
final ForallDescr forall = (ForallDescr) rule.getLhs().getDescrs().get(0);
assertEquals(2, forall.getDescrs().size());
final PatternDescr pattern = forall.getBasePattern();
assertEquals("Person", pattern.getObjectType());
final List<BaseDescr> remaining = forall.getRemainingPatterns();
assertEquals(1, remaining.size());
final PatternDescr cheese = (PatternDescr) remaining.get(0);
assertEquals("Cheese", cheese.getObjectType());
}
Aggregations