Search in sources :

Example 1 with DmnDecisionResultException

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

the class DmnDecisionTableResultTest method testMultipleOutputValues.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testMultipleOutputValues() {
    DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(MULTIPLE_OUTPUT_VALUES);
    assertThat(decisionResult).hasSize(1);
    assertMultipleOutputValues(decisionResult.getFirstResult());
    try {
        decisionResult.getSingleEntry();
        failBecauseExceptionWasNotThrown(DmnDecisionResultException.class);
    } catch (DmnDecisionResultException e) {
        assertThat(e).hasMessageStartingWith("DMN-01007").hasMessageContaining("multipleValues1").hasMessageContaining("multipleValues2");
    }
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) DmnDecisionResultException(org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 2 with DmnDecisionResultException

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

the class DmnDecisionResultTest method testMultipleOutputValues.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testMultipleOutputValues() {
    DmnDecisionResult decisionResult = evaluateWithMatchingRules(MULTIPLE_OUTPUT_VALUES);
    assertThat(decisionResult).hasSize(1);
    assertMultipleOutputValues(decisionResult.getFirstResult());
    try {
        decisionResult.getSingleEntry();
        failBecauseExceptionWasNotThrown(DmnDecisionResultException.class);
    } catch (DmnDecisionResultException e) {
        assertThat(e).hasMessageStartingWith("DMN-01010").hasMessageContaining("multipleValues1").hasMessageContaining("multipleValues2");
    }
}
Also used : DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) DmnDecisionResultException(org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 3 with DmnDecisionResultException

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

the class DmnDecisionResultTest method testMultipleResults.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testMultipleResults() {
    DmnDecisionResult decisionResult = evaluateWithMatchingRules(NO_OUTPUT_VALUE, SINGLE_OUTPUT_VALUE, MULTIPLE_OUTPUT_VALUES);
    assertThat(decisionResult).hasSize(3);
    DmnDecisionResultEntries ruleResult = decisionResult.get(0);
    assertNoOutputValue(ruleResult);
    ruleResult = decisionResult.get(1);
    assertSingleOutputValue(ruleResult);
    ruleResult = decisionResult.get(2);
    assertMultipleOutputValues(ruleResult);
    ruleResult = decisionResult.getFirstResult();
    assertNoOutputValue(ruleResult);
    try {
        decisionResult.getSingleResult();
        failBecauseExceptionWasNotThrown(DmnDecisionResultException.class);
    } catch (DmnDecisionResultException e) {
        assertThat(e).hasMessageStartingWith("DMN-01011").hasMessageContaining("singleValue").hasMessageContaining("multipleValues1").hasMessageContaining("multipleValues2");
    }
    try {
        decisionResult.getSingleEntry();
        failBecauseExceptionWasNotThrown(DmnDecisionResultException.class);
    } catch (DmnDecisionResultException e) {
        assertThat(e).hasMessageStartingWith("DMN-01011").hasMessageContaining("singleValue").hasMessageContaining("multipleValues1").hasMessageContaining("multipleValues2");
    }
}
Also used : DmnDecisionResultEntries(org.camunda.bpm.dmn.engine.DmnDecisionResultEntries) DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) DmnDecisionResultException(org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 4 with DmnDecisionResultException

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

the class DmnDecisionTableResultTest method testMultipleResults.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testMultipleResults() {
    DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(NO_OUTPUT_VALUE, SINGLE_OUTPUT_VALUE, MULTIPLE_OUTPUT_VALUES);
    assertThat(decisionResult).hasSize(3);
    DmnDecisionRuleResult ruleResult = decisionResult.get(0);
    assertNoOutputValue(ruleResult);
    ruleResult = decisionResult.get(1);
    assertSingleOutputValue(ruleResult);
    ruleResult = decisionResult.get(2);
    assertMultipleOutputValues(ruleResult);
    ruleResult = decisionResult.getFirstResult();
    assertNoOutputValue(ruleResult);
    try {
        decisionResult.getSingleResult();
        failBecauseExceptionWasNotThrown(DmnDecisionResultException.class);
    } catch (DmnDecisionResultException e) {
        assertThat(e).hasMessageStartingWith("DMN-01008").hasMessageContaining("singleValue").hasMessageContaining("multipleValues1").hasMessageContaining("multipleValues2");
    }
    try {
        decisionResult.getSingleEntry();
        failBecauseExceptionWasNotThrown(DmnDecisionResultException.class);
    } catch (DmnDecisionResultException e) {
        assertThat(e).hasMessageStartingWith("DMN-01008").hasMessageContaining("singleValue").hasMessageContaining("multipleValues1").hasMessageContaining("multipleValues2");
    }
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) DmnDecisionRuleResult(org.camunda.bpm.dmn.engine.DmnDecisionRuleResult) DmnDecisionResultException(org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Aggregations

DmnDecisionResultException (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException)4 DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)4 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)4 Test (org.junit.Test)4 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)2 DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)2 DmnDecisionResultEntries (org.camunda.bpm.dmn.engine.DmnDecisionResultEntries)1 DmnDecisionRuleResult (org.camunda.bpm.dmn.engine.DmnDecisionRuleResult)1