use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-engine-dmn by camunda.
the class FeelIntegrationTest method testFeelOutputEntryWithCustomEngine.
@Test
@DecisionResource(resource = DMN)
public void testFeelOutputEntryWithCustomEngine() {
DefaultDmnEngineConfiguration configuration = (DefaultDmnEngineConfiguration) getDmnEngineConfiguration();
configuration.setDefaultOutputEntryExpressionLanguage(DefaultDmnEngineConfiguration.FEEL_EXPRESSION_LANGUAGE);
DmnEngine engine = configuration.buildEngine();
// stubbing the default FEEL engine behavior
doReturn("a").when(feelEngineSpy).evaluateSimpleExpression(eq("\"a\""), any(VariableContext.class));
DmnDecisionResult decisionResult = engine.evaluateDecision(decision, Variables.createVariables().putValue("score", 3));
assertThat(decisionResult.getSingleEntry()).isEqualTo("a");
verify(feelEngineSpy).evaluateSimpleExpression(anyString(), any(VariableContext.class));
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-engine-dmn by camunda.
the class DmnDecisionEvaluationTest method shouldEvaluateDecisionWithBeanInvocationInLiteralExpression.
@Test
public void shouldEvaluateDecisionWithBeanInvocationInLiteralExpression() {
DmnDecisionResult result = dmnEngine.evaluateDecision(parseDecisionFromFile("decision", DMN_DECISION_WITH_BEAN_INVOCATION_IN_LITERAL_EXPRESSION), createVariables().putValue("x", 2).putValue("bean", new TestBean(3)));
assertThat(result.getSingleEntry()).isNotNull().isEqualTo(6);
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-engine-dmn by camunda.
the class DmnDecisionEvaluationTest method shouldEvaluateDecisionWithRuleOrderHitPolicyReturningAList.
@Test
public void shouldEvaluateDecisionWithRuleOrderHitPolicyReturningAList() {
DmnDecisionRequirementsGraph graph = dmnEngine.parseDecisionRequirementsGraph(IoUtil.fileAsStream(DRG_RULE_ORDER_DMN));
initVariables();
variables.putValue("dayType", "WeekDay");
DmnDecisionResult result = dmnEngine.evaluateDecision(graph.getDecision("dish-decision"), variables);
assertThat(result.getSingleEntry()).isNotNull().isEqualTo("Steak");
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-engine-dmn by camunda.
the class DmnDecisionEvaluationTest method shouldEvaluateDecisionWithLiteralExpression.
@Test
public void shouldEvaluateDecisionWithLiteralExpression() {
DmnDecisionResult result = dmnEngine.evaluateDecision(parseDecisionFromFile("decision", DMN_DECISION_WITH_LITERAL_EXPRESSION), createVariables().putValue("a", 2).putValue("b", 3));
assertThat(result.getSingleResult().keySet()).containsOnly("c");
assertThat(result.getSingleEntry()).isNotNull().isEqualTo(5);
}
Aggregations