use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class DmnDecisionTableResultTest method testSingleOutputTypedValue.
@Test
@DecisionResource(resource = RESULT_TEST_WITH_TYPES_DMN)
public void testSingleOutputTypedValue() {
DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
assertThat(decisionResult).hasSize(1);
DmnDecisionRuleResult ruleResult = decisionResult.getFirstResult();
TypedValue typedValue = ruleResult.getEntryTyped("firstOutput");
assertThat(typedValue).isEqualTo(Variables.stringValue("singleValue"));
typedValue = ruleResult.getEntryTyped("secondOutput");
assertThat(typedValue).isNull();
typedValue = ruleResult.getFirstEntryTyped();
assertThat(typedValue).isEqualTo(Variables.stringValue("singleValue"));
typedValue = ruleResult.getSingleEntryTyped();
assertThat(typedValue).isEqualTo(Variables.stringValue("singleValue"));
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class DmnDecisionTableResultTest method testOutputList.
@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testOutputList() {
DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE, MULTIPLE_OUTPUT_VALUES);
List<Map<String, Object>> entryMapList = decisionResult.getResultList();
assertThat(entryMapList).hasSize(2);
Map<String, Object> firstResult = entryMapList.get(0);
assertThat(firstResult).hasSize(1);
assertThat(firstResult).containsEntry("firstOutput", "singleValue");
Map<String, Object> secondResult = entryMapList.get(1);
assertThat(secondResult).hasSize(2);
assertThat(secondResult).containsEntry("firstOutput", "multipleValues1");
assertThat(secondResult).containsEntry("secondOutput", "multipleValues2");
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class DmnDecisionTableResultTest method testValueMap.
@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testValueMap() {
DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(MULTIPLE_OUTPUT_VALUES);
DmnDecisionRuleResult ruleResult = decisionResult.getSingleResult();
assertThat(ruleResult).hasSize(2);
Map<String, Object> entryMap = ruleResult.getEntryMap();
assertThat(entryMap).hasSize(2);
assertThat(entryMap).containsEntry("firstOutput", "multipleValues1");
assertThat(entryMap).containsEntry("secondOutput", "multipleValues2");
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class DmnEngineApiTest method shouldEvaluateDecisionTableWithVariableContext.
@Test
@DecisionResource(resource = ONE_RULE_DMN)
public void shouldEvaluateDecisionTableWithVariableContext() {
DmnDecisionTableResult results = dmnEngine.evaluateDecisionTable(decision, createVariables().putValue("input", INPUT_VALUE).asVariableContext());
assertThat(results).hasSingleResult().hasSingleEntry(EXPECTED_OUTPUT_VALUE);
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource 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);
}
Aggregations