use of org.drools.compiler.lang.ExpanderException in project drools by kiegroup.
the class DefaultExpanderTest method testLineNumberError.
@Test
public void testLineNumberError() throws Exception {
DSLMappingFile file = new DSLTokenizedMappingFile();
String dsl = "[when]foo=Foo()" + NL + "[then]bar {num}=baz({num});";
file.parseAndLoad(new StringReader(dsl));
DefaultExpander ex = new DefaultExpander();
ex.addDSLMapping(file.getMapping());
String source = "rule 'q'" + NL + "agenda-group 'x'" + NL + "when" + NL + " __ " + NL + "then" + NL + " bar 42" + NL + "\tgoober" + NL + "end";
ex.expand(source);
assertTrue(ex.hasErrors());
assertEquals(2, ex.getErrors().size());
ExpanderException err = (ExpanderException) ex.getErrors().get(0);
assertEquals(4, err.getLine());
err = (ExpanderException) ex.getErrors().get(1);
assertEquals(7, err.getLine());
}
Aggregations