use of org.drools.compiler.lang.descr.NotDescr in project drools by kiegroup.
the class RuleParserTest method testNotNode.
@Test
public void testNotNode() throws Exception {
final RuleDescr rule = (RuleDescr) parseResource("rule", "rule_not.drl");
assertFalse(parser.getErrors().toString(), parser.hasErrors());
assertNotNull(rule);
assertEquals("simple_rule", rule.getName());
final AndDescr lhs = rule.getLhs();
assertEquals(1, lhs.getDescrs().size());
final NotDescr not = (NotDescr) lhs.getDescrs().get(0);
assertEquals(1, not.getDescrs().size());
final PatternDescr pattern = (PatternDescr) not.getDescrs().get(0);
assertEquals("Cheese", pattern.getObjectType());
assertEquals(1, pattern.getConstraint().getDescrs().size());
final AndDescr and = (AndDescr) pattern.getConstraint();
final ExprConstraintDescr fld = (ExprConstraintDescr) and.getDescrs().get(0);
assertEquals("type == \"stilton\"", fld.getExpression());
}
Aggregations