use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-engine-dmn by camunda.
the class ExpressionEvaluationTest method testHasVariableContext.
@Test
@DecisionResource(resource = DMN_VARIABLE_CONTEXT)
public void testHasVariableContext() {
DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, Variables.createVariables().putValue("in", 3));
assertThat(decisionResult.getSingleEntry()).isEqualTo(true);
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-engine-dmn by camunda.
the class FeelIntegrationTest method testFeelInputExpressionWithCustomEngine.
@Test
@DecisionResource(resource = DMN)
public void testFeelInputExpressionWithCustomEngine() {
DefaultDmnEngineConfiguration configuration = (DefaultDmnEngineConfiguration) getDmnEngineConfiguration();
configuration.setDefaultInputExpressionExpressionLanguage(DefaultDmnEngineConfiguration.FEEL_EXPRESSION_LANGUAGE);
DmnEngine engine = configuration.buildEngine();
// stubbing the default FEEL engine behavior
doReturn(3).when(feelEngineSpy).evaluateSimpleExpression(eq("score"), 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 FeelIntegrationTest method testFeelInputEntry.
@Test
@DecisionResource(resource = DMN)
public void testFeelInputEntry() {
DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, Variables.createVariables().putValue("score", 3));
assertThat(decisionResult.getSingleEntry()).isEqualTo("a");
verify(feelEngineSpy, atLeastOnce()).evaluateSimpleUnaryTests(anyString(), anyString(), any(VariableContext.class));
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-engine-dmn by camunda.
the class FeelIntegrationTest method testFeelInputEntryWithAlternativeName.
@Test
@DecisionResource(resource = DMN)
public void testFeelInputEntryWithAlternativeName() {
DefaultDmnEngineConfiguration configuration = (DefaultDmnEngineConfiguration) getDmnEngineConfiguration();
configuration.setDefaultInputEntryExpressionLanguage("feel");
DmnEngine dmnEngine = configuration.buildEngine();
DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, Variables.createVariables().putValue("score", 3));
assertThat(decisionResult.getSingleEntry()).isEqualTo("a");
verify(feelEngineSpy, atLeastOnce()).evaluateSimpleUnaryTests(anyString(), anyString(), any(VariableContext.class));
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-engine-dmn by camunda.
the class DmnDecisionEvaluationTest method shouldEvaluateDecisionWithCollectHitPolicyReturningAList.
@Test
public void shouldEvaluateDecisionWithCollectHitPolicyReturningAList() {
DmnDecisionRequirementsGraph graph = dmnEngine.parseDecisionRequirementsGraph(IoUtil.fileAsStream(DRG_COLLECT_DMN));
initVariables();
variables.putValue("dayType", "WeekDay");
DmnDecisionResult result = dmnEngine.evaluateDecision(graph.getDecision("dish-decision"), variables);
assertThat(result.getSingleEntry()).isNotNull().isEqualTo("Steak");
}
Aggregations