Search in sources :

Example 21 with DmnModelInstance

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

the class DmnTransformTest method shouldDetectLoopInParseDecisionWithSelfRequiredDecision.

@Test
public void shouldDetectLoopInParseDecisionWithSelfRequiredDecision() {
    InputStream inputStream = IoUtil.fileAsStream(SELF_REQUIRED_DECISIONS_DMN);
    DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream);
    try {
        decision = dmnEngine.parseDecision("buyProduct", modelInstance);
        failBecauseExceptionWasNotThrown(DmnTransformException.class);
    } catch (DmnTransformException e) {
        Assertions.assertThat(e).hasMessageStartingWith("DMN-02004").hasMessageContaining("DMN-02015").hasMessageContaining("has a loop");
    }
}
Also used : DmnTransformException(org.camunda.bpm.dmn.engine.impl.transform.DmnTransformException) InputStream(java.io.InputStream) DmnModelInstance(org.camunda.bpm.model.dmn.DmnModelInstance) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Aggregations

DmnModelInstance (org.camunda.bpm.model.dmn.DmnModelInstance)21 Test (org.junit.Test)16 InputStream (java.io.InputStream)10 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)10 DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)5 Decision (org.camunda.bpm.model.dmn.instance.Decision)4 DmnTransformException (org.camunda.bpm.dmn.engine.impl.transform.DmnTransformException)3 Definitions (org.camunda.bpm.model.dmn.instance.Definitions)3 DecisionTable (org.camunda.bpm.model.dmn.instance.DecisionTable)2 Input (org.camunda.bpm.model.dmn.instance.Input)2 Output (org.camunda.bpm.model.dmn.instance.Output)2 DmnDecisionRequirementsGraph (org.camunda.bpm.dmn.engine.DmnDecisionRequirementsGraph)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)1 DecisionDefinitionEntity (org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionDefinitionEntity)1 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)1 Deployment (org.camunda.bpm.engine.test.Deployment)1 InputExpression (org.camunda.bpm.model.dmn.instance.InputExpression)1 Rule (org.camunda.bpm.model.dmn.instance.Rule)1 Text (org.camunda.bpm.model.dmn.instance.Text)1