I want to do junit for my rule files. My rule file broadly has two things:
- a rule
- a helper function (in drools, not Java) which I am calling from then section of a rule
Now I want to test(assert) this function isolatedly based on the test case. is there any way possible to do this?
function void print(String string){
System.out.println(string);
return true;
}
rule "XXYJK"
dialect "mvel"
salience 10
when
objofTheclass : exampleClass() eval
(
objofTheclass.isKeyMatched("XXYJK")
)
then
print("XXYJK");
end
Now I can call this rule from java code like this way.
statelessSession.setAgendaFilter(new RuleNameEqualsAgendaFilter("XXYJK"));
statelessSession.executeWithResults(rulesEngineParameters);
Now I want to do similar things without calling the rule itself or executing the whole drl file . Only the print() function I want to call.