use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class DmnDecisionTableResultTest method testSingleOutputNoName.
@Test
@DecisionResource(resource = RESULT_TEST_WITH_SINGLE_UNNAMED_OUTPUT_DMN)
public void testSingleOutputNoName() {
DmnDecisionTableResult decisionResult = evaluateDecisionTable();
assertThat(decisionResult).hasSize(1);
assertThat(decisionResult.getFirstResult()).hasSize(1);
assertThat(decisionResult.getFirstResult().getSingleEntry()).isEqualTo("outputValue");
assertThat(decisionResult.getFirstResult().get(null)).isEqualTo("outputValue");
assertThat(decisionResult.getSingleEntry()).isEqualTo("outputValue");
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class DmnDecisionTableResultTest method testSingleEntryUntypedValue.
@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testSingleEntryUntypedValue() {
DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
TypedValue typedValue = decisionResult.getSingleEntryTyped();
assertThat(typedValue).isEqualTo(Variables.untypedValue("singleValue"));
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class DmnDecisionTableResultTest method testSingleEntryTypedValue.
@Test
@DecisionResource(resource = RESULT_TEST_WITH_TYPES_DMN)
public void testSingleEntryTypedValue() {
DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
TypedValue typedValue = decisionResult.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 testMultipleResults.
@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testMultipleResults() {
DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(NO_OUTPUT_VALUE, SINGLE_OUTPUT_VALUE, MULTIPLE_OUTPUT_VALUES);
assertThat(decisionResult).hasSize(3);
DmnDecisionRuleResult 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-01008").hasMessageContaining("singleValue").hasMessageContaining("multipleValues1").hasMessageContaining("multipleValues2");
}
try {
decisionResult.getSingleEntry();
failBecauseExceptionWasNotThrown(DmnDecisionResultException.class);
} catch (DmnDecisionResultException e) {
assertThat(e).hasMessageStartingWith("DMN-01008").hasMessageContaining("singleValue").hasMessageContaining("multipleValues1").hasMessageContaining("multipleValues2");
}
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class DmnDecisionTableResultTest method testNoOutputValue.
@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testNoOutputValue() {
DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(NO_OUTPUT_VALUE);
assertThat(decisionResult).hasSize(1);
assertNoOutputValue(decisionResult.getFirstResult());
assertThat(decisionResult.getSingleEntry()).isNull();
}
Aggregations