use of org.camunda.bpm.dmn.engine.DmnDecisionResultEntries in project camunda-engine-dmn by camunda.
the class DmnDecisionResultTest method testMultipleResults.
@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testMultipleResults() {
DmnDecisionResult decisionResult = evaluateWithMatchingRules(NO_OUTPUT_VALUE, SINGLE_OUTPUT_VALUE, MULTIPLE_OUTPUT_VALUES);
assertThat(decisionResult).hasSize(3);
DmnDecisionResultEntries ruleResult = decisionResult.get(0);
assertNoOutputValue(ruleResult);
ruleResult = decisionResult.get(1);
assertSingleOutputValue(ruleResult);
ruleResult = decisionResult.get(2);
assertMultipleOutputValues(ruleResult);
ruleResult = decisionResult.getFirstResult();
assertNoOutputValue(ruleResult);
try {
decisionResult.getSingleResult();
failBecauseExceptionWasNotThrown(DmnDecisionResultException.class);
} catch (DmnDecisionResultException e) {
assertThat(e).hasMessageStartingWith("DMN-01011").hasMessageContaining("singleValue").hasMessageContaining("multipleValues1").hasMessageContaining("multipleValues2");
}
try {
decisionResult.getSingleEntry();
failBecauseExceptionWasNotThrown(DmnDecisionResultException.class);
} catch (DmnDecisionResultException e) {
assertThat(e).hasMessageStartingWith("DMN-01011").hasMessageContaining("singleValue").hasMessageContaining("multipleValues1").hasMessageContaining("multipleValues2");
}
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResultEntries in project camunda-engine-dmn by camunda.
the class DmnDecisionResultTest method testSingleOutputUntypedValue.
@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testSingleOutputUntypedValue() {
DmnDecisionResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
assertThat(decisionResult).hasSize(1);
DmnDecisionResultEntries ruleResult = decisionResult.getFirstResult();
TypedValue typedEntry = ruleResult.getEntryTyped("firstOutput");
assertThat(typedEntry).isEqualTo(Variables.untypedValue("singleValue"));
typedEntry = ruleResult.getEntryTyped("secondOutput");
assertThat(typedEntry).isNull();
typedEntry = ruleResult.getFirstEntryTyped();
assertThat(typedEntry).isEqualTo(Variables.untypedValue("singleValue"));
typedEntry = ruleResult.getSingleEntryTyped();
assertThat(typedEntry).isEqualTo(Variables.untypedValue("singleValue"));
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResultEntries in project camunda-bpm-platform by camunda.
the class DecisionDefinitionResourceImpl method createDecisionResultDto.
protected List<Map<String, VariableValueDto>> createDecisionResultDto(DmnDecisionResult decisionResult) {
List<Map<String, VariableValueDto>> dto = new ArrayList<Map<String, VariableValueDto>>();
for (DmnDecisionResultEntries entries : decisionResult) {
Map<String, VariableValueDto> resultEntriesDto = createResultEntriesDto(entries);
dto.add(resultEntriesDto);
}
return dto;
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResultEntries in project camunda-bpm-platform by camunda.
the class DmnDecisionTaskResultListenerTest method testEmptyOutput.
@Deployment(resources = { TEST_CASE, TEST_DECISION })
public void testEmptyOutput() {
startTestCase("empty output");
assertFalse("The decision result 'ruleResult' should not be empty", results.isEmpty());
DmnDecisionResultEntries decisionOutput = results.get(0);
assertNull(decisionOutput.getFirstEntry());
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResultEntries in project camunda-bpm-platform by camunda.
the class DmnDecisionTaskResultListenerTest method testEmptyMap.
@Deployment(resources = { TEST_CASE, TEST_DECISION })
public void testEmptyMap() {
startTestCase("empty map");
assertEquals(2, results.size());
for (DmnDecisionResultEntries output : results) {
assertTrue("The decision output should be empty", output.isEmpty());
}
}
Aggregations