class RuleScenarioRunnerHelper extends AbstractRunnerHelper {

    protected Function<Object, ValueWrapper> createExtractorFunction(ExpressionEvaluator expressionEvaluator,
                                                                     FactMappingValue expectedResult,
                                                                     ScesimModelDescriptor scesimModelDescriptor) {
        return objectToCheck -> {

            ExpressionIdentifier expressionIdentifier = expectedResult.getExpressionIdentifier();

            FactMapping factMapping = scesimModelDescriptor.getFactMapping(expectedResult.getFactIdentifier(), expressionIdentifier)
                    .orElseThrow(() -> new IllegalStateException("Wrong expression, this should not happen"));

            List<String> pathToValue = factMapping.getExpressionElementsWithoutClass().stream().map(ExpressionElement::getStep).collect(toList());
            ScenarioBeanWrapper<?> scenarioBeanWrapper = ScenarioBeanUtil.navigateToObject(objectToCheck, pathToValue, false);
            Object resultValue = scenarioBeanWrapper.getBean();
            Object expectedResultValue = expectedResult.getRawValue();

            return getResultWrapper(factMapping.getClassName(),
                                    expectedResult,
                                    expressionEvaluator,
                                    expectedResultValue,
                                    resultValue,
                                    scenarioBeanWrapper.getBeanClass());
        };
    }

}