use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-engine-dmn by camunda.
the class DmnEngineApiTest method shouldEvaluateDecisionTableWithVariableMap.
@Test
@DecisionResource(resource = ONE_RULE_DMN)
public void shouldEvaluateDecisionTableWithVariableMap() {
DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(decision, createVariables().putValue("input", INPUT_VALUE));
assertThat(results).hasSingleResult().hasSingleEntry(EXPECTED_OUTPUT_VALUE);
}
use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-engine-dmn by camunda.
the class DmnDecisionEvaluationTest method shouldEvaluateDecisionsWithNoMatchingRuleAndDefaultRuleInParent.
@Test
public void shouldEvaluateDecisionsWithNoMatchingRuleAndDefaultRuleInParent() {
DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(parseDecisionFromFile("A", DMN_DECISIONS_WITH_DIFFERENT_INPUT_OUTPUT_TYPES), createVariables().putValue("dd", "7").putValue("ee", 2147483650L).asVariableContext());
assertThat(results).hasSingleResult().containsEntry("aa", 7.2);
}
use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-engine-dmn by camunda.
the class DmnDecisionEvaluationTest method shouldEvaluateDecisionsWithDefaultRuleInChildDecision.
@Test
public void shouldEvaluateDecisionsWithDefaultRuleInChildDecision() {
DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(parseDecisionFromFile("A", DMN_DECISIONS_WITH_DEFAULT_RULE_IN_CHILD), createVariables().putValue("dd", // There is no rule in the table matching the input 7
"7").asVariableContext());
assertThat(results).hasSingleResult().containsEntry("aa", 7.0);
}
use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-engine-dmn by camunda.
the class DmnDecisionEvaluationTest method shouldEvaluateDrdDishDecisionExample.
@Test
public void shouldEvaluateDrdDishDecisionExample() {
DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(parseDecisionFromFile("Dish", DMN_DECISIONS_WITH_DISH_DECISON_EXAMPLE), createVariables().putValue("temperature", 20).putValue("dayType", "Weekend"));
assertThat(results).hasSingleResult().containsEntry("desiredDish", "Steak");
}
use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-engine-dmn by camunda.
the class DmnDecisionEvaluationTest method shouldEvaluateDecisionsWithDifferentInputAndOutputTypes.
@Test
public void shouldEvaluateDecisionsWithDifferentInputAndOutputTypes() {
DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(parseDecisionFromFile("A", DMN_DECISIONS_WITH_DIFFERENT_INPUT_OUTPUT_TYPES), createVariables().putValue("dd", "5").putValue("ee", 21).asVariableContext());
assertThat(results.get(0)).containsEntry("aa", 7.1);
results = dmnEngine.evaluateDecisionTable(parseDecisionFromFile("A", DMN_DECISIONS_WITH_DIFFERENT_INPUT_OUTPUT_TYPES), createVariables().putValue("dd", "5").putValue("ee", 2147483650L).asVariableContext());
assertThat(results.get(0)).containsEntry("aa", 7.0);
}
Aggregations