Search in sources :

Example 36 with DmnDecisionResult

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

the class DmnDecisionResultTest method testCollectOutputValues.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testCollectOutputValues() {
    DmnDecisionResult 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 : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 37 with DmnDecisionResult

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

the class DmnDecisionResultTest method testNoOutputValue.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testNoOutputValue() {
    DmnDecisionResult decisionResult = evaluateWithMatchingRules(NO_OUTPUT_VALUE);
    assertThat(decisionResult).hasSize(1);
    assertNoOutputValue(decisionResult.getFirstResult());
    assertThat(decisionResult.getSingleEntry()).isNull();
}
Also used : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 38 with DmnDecisionResult

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

the class DmnDecisionResultTest method testSingleOutputNoName.

@Test
@DecisionResource(resource = RESULT_TEST_WITH_SINGLE_UNNAMED_OUTPUT_DMN)
public void testSingleOutputNoName() {
    DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, variables);
    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");
}
Also used : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 39 with DmnDecisionResult

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

the class DmnDecisionResultTest method testOutputList.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testOutputList() {
    DmnDecisionResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE, MULTIPLE_OUTPUT_VALUES);
    List<Map<String, Object>> entryMapList = decisionResult.getResultList();
    assertThat(entryMapList).hasSize(2);
    Map<String, Object> firstResult = entryMapList.get(0);
    assertThat(firstResult).hasSize(1);
    assertThat(firstResult).containsEntry("firstOutput", "singleValue");
    Map<String, Object> secondResult = entryMapList.get(1);
    assertThat(secondResult).hasSize(2);
    assertThat(secondResult).containsEntry("firstOutput", "multipleValues1");
    assertThat(secondResult).containsEntry("secondOutput", "multipleValues2");
}
Also used : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) Map(java.util.Map) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 40 with DmnDecisionResult

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

the class DmnDecisionResultTest method testNoResult.

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

Aggregations

DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)54 Test (org.junit.Test)40 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)29 DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)25 HashMap (java.util.HashMap)6 Matchers.containsString (org.hamcrest.Matchers.containsString)6 Matchers.anyString (org.mockito.Matchers.anyString)6 Deployment (org.camunda.bpm.engine.test.Deployment)5 DmnDecisionResultEntries (org.camunda.bpm.dmn.engine.DmnDecisionResultEntries)4 DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)4 VariableContext (org.camunda.bpm.engine.variable.context.VariableContext)4 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)4 DmnEngine (org.camunda.bpm.dmn.engine.DmnEngine)3 DefaultDmnEngineConfiguration (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)3 MockDecisionResultBuilder (org.camunda.bpm.engine.rest.helper.MockDecisionResultBuilder)3 DmnDecisionRequirementsGraph (org.camunda.bpm.dmn.engine.DmnDecisionRequirementsGraph)2 DmnDecisionResultException (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)1