@Test
public void verifyConditions() {

    ScenarioRunnerData scenarioRunnerData1 = new ScenarioRunnerData();
    scenarioRunnerData1.addExpect(new ScenarioExpect(personFactIdentifier, singletonList(firstNameExpectedValue)));
    // test 1 - no decision generated for specific decisionName
    assertThatThrownBy(() -> runnerHelper.verifyConditions(simulation.getScesimModelDescriptor(), scenarioRunnerData1, expressionEvaluatorFactory, requestContextMock))
            .isInstanceOf(ScenarioException.class)
            .hasMessage("DMN execution has not generated a decision result with name Fact 1");
    when(dmnResultMock.getDecisionResultByName(anyString())).thenReturn(dmnDecisionResultMock);
    when(dmnDecisionResultMock.getEvaluationStatus()).thenReturn(DecisionEvaluationStatus.SUCCEEDED);
    // test 2 - when decisionResult contains a null value skip the steps and just do the comparison (that should be false in this case)
    runnerHelper.verifyConditions(simulation.getScesimModelDescriptor(), scenarioRunnerData1, expressionEvaluatorFactory, requestContextMock);
    assertEquals(1, scenarioRunnerData1.getResults().size());
    assertFalse(scenarioRunnerData1.getResults().get(0).getResult());
    when(dmnDecisionResultMock.getResult()).thenReturn("");
    // test 3 - now result is not null but data structure is wrong (expected steps but data is a simple string)
    assertThatThrownBy(() -> runnerHelper.verifyConditions(simulation.getScesimModelDescriptor(), scenarioRunnerData1, expressionEvaluatorFactory, requestContextMock))
            .isInstanceOf(ScenarioException.class)
            .hasMessage("Wrong resultRaw structure because it is not a complex type as expected");
    Map<String, Object> resultMap = new HashMap<>();
    resultMap.put("firstName", "WrongValue");
    when(dmnDecisionResultMock.getResult()).thenReturn(resultMap);
    ScenarioRunnerData scenarioRunnerData2 = new ScenarioRunnerData();
    scenarioRunnerData2.addExpect(new ScenarioExpect(personFactIdentifier, singletonList(firstNameExpectedValue)));
    // test 4 - check are performed (but fail)
    runnerHelper.verifyConditions(simulation.getScesimModelDescriptor(), scenarioRunnerData2, expressionEvaluatorFactory, requestContextMock);
    assertEquals(1, scenarioRunnerData2.getResults().size());
    assertFalse(scenarioRunnerData2.getResults().get(0).getResult());
    ScenarioRunnerData scenarioRunnerData3 = new ScenarioRunnerData();
    scenarioRunnerData3.addExpect(new ScenarioExpect(personFactIdentifier, singletonList(firstNameExpectedValue)));
    resultMap.put("firstName", NAME);
    // test 5 - check are performed (but success)
    runnerHelper.verifyConditions(simulation.getScesimModelDescriptor(), scenarioRunnerData3, expressionEvaluatorFactory, requestContextMock);
    assertEquals(1, scenarioRunnerData3.getResults().size());
    assertTrue(scenarioRunnerData3.getResults().get(0).getResult());
    // test 6 - verify that when expression evaluation fails the corresponding expression is marked as error
    ExpressionEvaluatorFactory expressionEvaluatorFactoryMock = mock(ExpressionEvaluatorFactory.class);
    when(expressionEvaluatorFactoryMock.getOrCreate(any())).thenReturn(mock(ExpressionEvaluator.class));
    runnerHelper.verifyConditions(simulation.getScesimModelDescriptor(),
                                  scenarioRunnerData3,
                                  expressionEvaluatorFactoryMock,
                                  requestContextMock);
    assertEquals(FactMappingValueStatus.FAILED_WITH_ERROR, scenarioRunnerData3.getResults().get(0).getFactMappingValue().getStatus());
}