assertFalse( this.parser.hasErrors() );
}
public void testConsequenceWithDeclaration() throws Exception {
final RuleDescr rule = parseResource( "declaration-in-consequence.drl" ).rule();
assertNotNull( rule );
assertEquals( "myrule",
rule.getName() );
final String expected = "int i = 0; i = 1; i / 1; i == 1; i(i); i = 'i'; i.i.i; i\\i; i<i; i>i; i=\"i\"; ++i;" + "i++; --i; i--; i += i; i -= i; i *= i; i /= i;" + "int i = 5;" + "for(int j; j<i; ++j) {" + "System.out.println(j);}"
+ "Object o = new String(\"Hello\");" + "String s = (String) o;";
assertEqualsIgnoreWhitespace( expected,
(String) rule.getConsequence() );
assertTrue( ((String) rule.getConsequence()).indexOf( "++" ) > 0 );
assertTrue( ((String) rule.getConsequence()).indexOf( "--" ) > 0 );
assertTrue( ((String) rule.getConsequence()).indexOf( "+=" ) > 0 );
assertTrue( ((String) rule.getConsequence()).indexOf( "==" ) > 0 );
//System.out.println(( String ) rule.getConsequence());
//note, need to assert that "i++" is preserved as is, no extra spaces.
assertFalse( this.parser.hasErrors() );