use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class FeelIntegrationTest method testFeelInputExpression.
@Test
@DecisionResource(resource = DMN)
public void testFeelInputExpression() {
DefaultDmnEngineConfiguration configuration = (DefaultDmnEngineConfiguration) getDmnEngineConfiguration();
configuration.setDefaultInputExpressionExpressionLanguage(DefaultDmnEngineConfiguration.FEEL_EXPRESSION_LANGUAGE);
DmnEngine engine = configuration.buildEngine();
try {
engine.evaluateDecision(decision, Variables.createVariables().putValue("score", 3));
failBecauseExceptionWasNotThrown(UnsupportedOperationException.class);
} catch (UnsupportedOperationException e) {
assertThat(e).hasMessageStartingWith("FEEL-01016");
verify(feelEngineSpy).evaluateSimpleExpression(anyString(), any(VariableContext.class));
}
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class FeelIntegrationTest method testDateAndTimeIntegration.
@Test
@DecisionResource()
public void testDateAndTimeIntegration() {
Date testDate = new Date(1445526087000L);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
variables.putValue("dateString", format.format(testDate));
assertThatDecisionTableResult().hasSingleResult().hasSingleEntryTyped(Variables.dateValue(testDate));
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class HitPolicyTest method testRuleOrderHitPolicyCompoundOutputMultipleMatchingRules.
@Test
@DecisionResource(resource = RULE_ORDER_COMPOUND)
public void testRuleOrderHitPolicyCompoundOutputMultipleMatchingRules() {
DmnDecisionTableResult results = evaluateDecisionTable(true, true, false, "a", "b", "c");
assertThat(results).hasSize(2);
assertThat(results.get(0)).containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
assertThat(results.get(1)).containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
results = evaluateDecisionTable(true, true, false, "c", "b", "a");
assertThat(results).hasSize(2);
assertThat(results.get(0)).containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
assertThat(results.get(1)).containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
results = evaluateDecisionTable(true, false, true, "a", "b", "c");
assertThat(results).hasSize(2);
assertThat(results.get(0)).containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
assertThat(results.get(1)).containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
results = evaluateDecisionTable(true, false, true, "c", "b", "a");
assertThat(results).hasSize(2);
assertThat(results.get(0)).containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
assertThat(results.get(1)).containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
results = evaluateDecisionTable(false, true, true, "a", "b", "c");
assertThat(results).hasSize(2);
assertThat(results.get(0)).containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
assertThat(results.get(1)).containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
results = evaluateDecisionTable(false, true, true, "c", "b", "a");
assertThat(results).hasSize(2);
assertThat(results.get(0)).containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
assertThat(results.get(1)).containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
results = evaluateDecisionTable(true, true, true, "a", "b", "c");
assertThat(results).hasSize(3);
assertThat(results.get(0)).containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
assertThat(results.get(1)).containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
assertThat(results.get(2)).containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
results = evaluateDecisionTable(true, true, true, "c", "b", "a");
assertThat(results).hasSize(3);
assertThat(results.get(0)).containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
assertThat(results.get(1)).containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
assertThat(results.get(2)).containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class HitPolicyTest method testRuleOrderHitPolicySingleOutputMultipleMatchingRules.
@Test
@DecisionResource(resource = RULE_ORDER_SINGLE)
public void testRuleOrderHitPolicySingleOutputMultipleMatchingRules() {
DmnDecisionTableResult results = evaluateDecisionTable(true, true, false, "a", "b", "c");
assertThat(results).hasSize(2);
assertThat(collectSingleOutputEntries(results)).containsExactly("a", "b");
results = evaluateDecisionTable(true, true, false, "c", "b", "a");
assertThat(results).hasSize(2);
assertThat(collectSingleOutputEntries(results)).containsExactly("c", "b");
results = evaluateDecisionTable(true, false, true, "a", "b", "c");
assertThat(results).hasSize(2);
assertThat(collectSingleOutputEntries(results)).containsExactly("a", "c");
results = evaluateDecisionTable(true, false, true, "c", "b", "a");
assertThat(results).hasSize(2);
assertThat(collectSingleOutputEntries(results)).containsExactly("c", "a");
results = evaluateDecisionTable(false, true, true, "a", "b", "c");
assertThat(results).hasSize(2);
assertThat(collectSingleOutputEntries(results)).containsExactly("b", "c");
results = evaluateDecisionTable(false, true, true, "c", "b", "a");
assertThat(results).hasSize(2);
assertThat(collectSingleOutputEntries(results)).containsExactly("b", "a");
results = evaluateDecisionTable(true, true, true, "a", "b", "c");
assertThat(results).hasSize(3);
assertThat(collectSingleOutputEntries(results)).containsExactly("a", "b", "c");
results = evaluateDecisionTable(true, true, true, "c", "b", "a");
assertThat(results).hasSize(3);
assertThat(collectSingleOutputEntries(results)).containsExactly("c", "b", "a");
}
use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.
the class HitPolicyTest method testCollectHitPolicyCompoundOutputSingleMatchingRule.
@Test
@DecisionResource(resource = COLLECT_COMPOUND)
public void testCollectHitPolicyCompoundOutputSingleMatchingRule() {
DmnDecisionTableResult results = evaluateDecisionTable(true, false, false, "a", "b", "c");
assertThat(results).hasSingleResult().containsOnly(entry("out1", "a"), entry("out2", "a"), entry("out3", "a"));
results = evaluateDecisionTable(false, true, false, "a", "b", "c");
assertThat(results).hasSingleResult().containsOnly(entry("out1", "b"), entry("out2", "b"), entry("out3", "b"));
results = evaluateDecisionTable(false, false, true, "a", "b", "c");
assertThat(results).hasSingleResult().containsOnly(entry("out1", "c"), entry("out2", "c"), entry("out3", "c"));
}
Aggregations