> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aseeflow.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing Decisions with the DMN Engine

To easily test DMN decisions in a JUnit test, the DMN engine provides a
JUnit Rule. The [DmnEngineRule](https://docs.camunda.org/javadoc/camunda-bpm-platform/7.24/org/camunda/bpm/dmn/engine/test/DmnEngineRule.html) creates a new default DMN engine. The DMN engine can be used in test cases to parse and evaluate decisions.

```java theme={null}
public class DecisionTest {

  @Rule
  public DmnEngineRule dmnEngineRule = new DmnEngineRule();

  @Test
  public void test() {
    DmnEngine dmnEngine = dmnEngineRule.getDmnEngine();
    // load DMN file
    InputStream inputStream = ...;
    //create and add variables
    VariableMap variables = Variables.createVariables();

    DmnDecision decision = dmnEngine.parseDecision("decision", inputStream);
    DmnDecisionResult result = dmnEngine.evaluateDecision(decision, variables);

    // assert the result
    // ...
  }

}
```

If you want to create a DMN engine with a custom configuration, you can pass
this to the DMN engine rule.

```java theme={null}
public class DecisionTest {

  @Rule
  public DmnEngineRule dmnEngineRule = new DmnEngineRule(createCustomConfiguration());

  public DmnEngineConfiguration createCustomConfiguration() {
    // create and return custom configuration
    return ...;
  }

  @Test
  public void test() {
    DmnEngine customDmnEngine = dmnEngineRule.getDmnEngine();
    // ...
  }

}
```

The [DmnDecisionResult](https://docs.camunda.org/javadoc/camunda-bpm-platform/7.24/org/camunda/bpm/dmn/engine/DmnDecisionResult.html) implements the interface
`List<DmnDecisionResultEntries>`. Whereas the [DmnDecisionResultEntries](https://docs.camunda.org/javadoc/camunda-bpm-platform/7.24/org/camunda/bpm/dmn/engine/DmnDecisionResultEntries.html) implements the interface `Map<String, Object>`.
This allows you to use common `List` or `Map` asserts.
