@SuppressWarnings("unchecked")
    protected ValueWrapper getSingleFactValueResult(FactMapping factMapping,
                                                    FactMappingValue expectedResult,
                                                    DMNDecisionResult decisionResult,
                                                    List<DMNMessage> failureMessages,
                                                    ExpressionEvaluator expressionEvaluator) {
        Object resultRaw = decisionResult.getResult();
        final DMNDecisionResult.DecisionEvaluationStatus evaluationStatus = decisionResult.getEvaluationStatus();
        if (!SUCCEEDED.equals(evaluationStatus)) {
            String failureReason = determineFailureMessage(evaluationStatus, failureMessages);
            return errorWithMessage("The decision \"" +
                                            decisionResult.getDecisionName() +
                                            "\" has not been successfully evaluated: " +
                                            failureReason);
        }

        List<ExpressionElement> elementsWithoutClass = factMapping.getExpressionElementsWithoutClass();

        // DMN engine doesn't generate the whole object when no entry of the decision table match
        if (resultRaw != null) {
            for (ExpressionElement expressionElement : elementsWithoutClass) {
                if (!(resultRaw instanceof Map)) {
                    throw new ScenarioException("Wrong resultRaw structure because it is not a complex type as expected");
                }
                Map<String, Object> result = (Map<String, Object>) resultRaw;
                resultRaw = result.get(expressionElement.getStep());
            }
        }

        Class<?> resultClass = resultRaw != null ? resultRaw.getClass() : null;

        Object expectedResultRaw = expectedResult.getRawValue();
        return getResultWrapper(factMapping.getClassName(),
                                expectedResult,
                                expressionEvaluator,
                                expectedResultRaw,
                                resultRaw,
                                resultClass);
    }
@Test
    public void getSingleFactValueResult_failDecisionWithMessages() {
        DMNMessage errorMessage = new DMNMessageImpl(ERROR, "DMN Internal Error", DMNMessageType.FEEL_EVALUATION_ERROR, null);
        DMNMessage warnMessage = new DMNMessageImpl(WARN, "DMN Internal Warn", DMNMessageType.FEEL_EVALUATION_ERROR, null);

        DMNDecisionResult failedDecision = createDecisionResultMock("Test", false, new ArrayList<>());
        
        ValueWrapper<?> failedResult = runnerHelper.getSingleFactValueResult(null,
                                                                             null,
                                                                             failedDecision,
                                                                             List.of(warnMessage, errorMessage),
                                                                             expressionEvaluator);
        assertThat(failedResult.isValid()).isFalse();
        assertThat(failedResult.getErrorMessage().get()).isEqualTo("The decision \"" +
                failedDecision.getDecisionName() +
                "\" has not been successfully evaluated: DMN Internal Error");
    }