class AbstractRunnerHelper {

    protected ValueWrapper getResultWrapper(String className,
                                            FactMappingValue expectedResult,
                                            ExpressionEvaluator expressionEvaluator,
                                            Object expectedResultRaw,
                                            Object resultRaw,
                                            Class<?> resultClass) {
        try {
            boolean evaluationSucceed = expressionEvaluator.evaluateUnaryExpression((String) expectedResultRaw, resultRaw, resultClass);
            if (evaluationSucceed) {
                return of(resultRaw);
            } else if (isCollection(className)) {
                // no suggestions for collection yet
                return errorWithMessage("Impossible to find elements in the collection to satisfy the conditions");
            } else {
                return errorWithValidValue(resultRaw, expectedResultRaw);
            }
        } catch (Exception e) {
            expectedResult.setExceptionMessage(e.getMessage());
            return errorWithMessage(e.getMessage());
        }
    }

}