Search in sources :

Example 6 with DecisionResource

use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.

the class DmnDecisionTableResultTest method testSingleOutputValue.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testSingleOutputValue() {
    DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
    assertThat(decisionResult).hasSize(1);
    assertSingleOutputValue(decisionResult.getFirstResult());
    assertThat(decisionResult.getSingleEntry()).isEqualTo("singleValue");
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 7 with DecisionResource

use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.

the class DmnDecisionTableResultTest method testSingleResult.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testSingleResult() {
    DmnDecisionTableResult results = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
    assertThat(results).hasSize(1);
    assertSingleOutputValue(results.get(0));
    assertSingleOutputValue(results.getFirstResult());
    assertSingleOutputValue(results.getSingleResult());
    assertThat(results.getSingleEntry()).isEqualTo("singleValue");
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 8 with DecisionResource

use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.

the class DmnDecisionTableResultTest method testCollectOutputValues.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testCollectOutputValues() {
    DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(NO_OUTPUT_VALUE, SINGLE_OUTPUT_VALUE, MULTIPLE_OUTPUT_VALUES);
    assertThat(decisionResult).hasSize(3);
    List<String> entryValues = decisionResult.collectEntries("firstOutput");
    assertThat(entryValues).containsExactly("singleValue", "multipleValues1");
    entryValues = decisionResult.collectEntries("secondOutput");
    assertThat(entryValues).containsExactly("multipleValues2");
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 9 with DecisionResource

use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.

the class DmnDecisionTableResultTest method testSingleOutputUntypedValue.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testSingleOutputUntypedValue() {
    DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
    assertThat(decisionResult).hasSize(1);
    DmnDecisionRuleResult 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"));
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) DmnDecisionRuleResult(org.camunda.bpm.dmn.engine.DmnDecisionRuleResult) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 10 with DecisionResource

use of org.camunda.bpm.dmn.engine.test.DecisionResource in project camunda-engine-dmn by camunda.

the class DmnDecisionTableResultTest method testNoResult.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testNoResult() {
    DmnDecisionTableResult results = evaluateWithMatchingRules();
    assertThat(results).isEmpty();
    assertThat(results.getFirstResult()).isNull();
    assertThat(results.getSingleResult()).isNull();
    assertThat(results.getSingleEntry()).isNull();
    assertThat(results.getSingleEntryTyped()).isNull();
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Aggregations

DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)56 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)56 Test (org.junit.Test)56 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)25 DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)20 DmnEngine (org.camunda.bpm.dmn.engine.DmnEngine)10 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)8 DefaultDmnEngineConfiguration (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)5 DmnDecisionResultEntries (org.camunda.bpm.dmn.engine.DmnDecisionResultEntries)4 DmnDecisionRuleResult (org.camunda.bpm.dmn.engine.DmnDecisionRuleResult)4 DmnDecisionResultException (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException)4 VariableContext (org.camunda.bpm.engine.variable.context.VariableContext)4 Map (java.util.Map)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 DmnDecisionLiteralExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionLiteralExpressionImpl)1 DmnDecisionTableImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl)1 DmnDecisionTableInputImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableInputImpl)1 DmnDecisionTableRuleImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl)1 DmnExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)1