I would like to contribute some code to the DmnEngineRule and I would like to know if there is interest of doing so. Following features:
declarative approach for loading dmn resources
declarative approach for “deploying”/“activating” specific dmn rule
convenience methods for “evaluateDecision” and “evaluateDecisionTable”
Example unit test:
@DmnResource(resources = "/rule.dmn")
public class RptNttMatchClassicTest {
@Rule
public DmnEngineRule dmnEngineRule = new DmnEngineRule();
@Test
@DmnDecisionKey(name = "rule-id")
public void rptTTMatchClassicNormaliseProductsTest() {
// given
Map<String, Object> variables = new HashMap<String, Object>();
...
// when
DmnDecisionResult dmnDecisionResult = dmnEngineRule.evaluateDecision(variables);
// then
...
}
}
My idea is highly inspired by the BPMN unit test support!
It wouild be nice if I could have an abstraction on decisionTableResult.getFirstResult() without knowledge about the internal structure of the DmnDecisionTableResult or DmnDecisionResult.
Maybe something that matches the hitpolicy or the result mapping like
The DmnDecisionResult implements the interface List<DmnDecisionResultEntries> . Whereas the DmnDecisionResultEntries implements the interface Map<String, Object> . This allows you to use common List or Map asserts.