How do you unit test Jboss Rules (Drools) rules?
Add the following code to a unit test (JUnit, TestNG, etc):
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new InputStreamReader(getClass().getResourceAsStream( "rules.drl")));
PackageBuilderErrors errors = builder.getErrors();
Assert.assertEquals(0, errors.getErrors().length);
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(pkg);
StatefullSession session = ruleBase.newStatefulSession(false);
MyFactObject myFact = new MyFactObject();
session.insert(myFact);
session.fireAllRules();