AbstractRunnerHelper { protected ScenarioResult fillResult(FactMappingValue expectedResult, Supplier<ValueWrapper<?>> resultSupplier, ExpressionEvaluator expressionEvaluator) { ValueWrapper<?> resultValue = resultSupplier.get(); if (resultValue.isValid()) { expectedResult.resetStatus(); } else if (resultValue.getErrorMessage().isPresent()) { expectedResult.setExceptionMessage(resultValue.getErrorMessage().get()); } else { try { expectedResult.setErrorValue(expressionEvaluator.fromObjectToExpression(resultValue.getValue())); } catch (Exception e) { expectedResult.setExceptionMessage(e.getMessage()); } } return new ScenarioResult(expectedResult, resultValue.getValue()).setResult(resultValue.isValid()); }  void run(KieContainer kieContainer,
                    ScesimModelDescriptor scesimModelDescriptor,
                    ScenarioWithIndex scenarioWithIndex,
                    ExpressionEvaluatorFactory expressionEvaluatorFactory,
                    ClassLoader classLoader,
                    ScenarioRunnerData scenarioRunnerData,
                    Settings settings,
                    Background background);  }
@Test public void fillResult() { FactIdentifier factIdentifier = FactIdentifier.create("MyInstance", String.class.getCanonicalName()); ExpressionIdentifier expressionIdentifier = ExpressionIdentifier.create("MyProperty", FactMappingType.GIVEN); FactMappingValue expectedResultSpy = spy(new FactMappingValue(factIdentifier, expressionIdentifier, VALUE)); AtomicReference<ValueWrapper> resultWrapperAtomicReference = new AtomicReference<>(); Supplier<ValueWrapper<?>> resultWrapperSupplier = resultWrapperAtomicReference::get; ExpressionEvaluator expressionEvaluator = new BaseExpressionEvaluator(AbstractRunnerHelper.class.getClassLoader()); resultWrapperAtomicReference.set(ValueWrapper.of(VALUE)); assertTrue(abstractRunnerHelper.fillResult(expectedResultSpy, resultWrapperSupplier, expressionEvaluator).getResult()); verify(expectedResultSpy, times(1)).resetStatus(); reset(expectedResultSpy); resultWrapperAtomicReference.set(ValueWrapper.errorWithValidValue(VALUE, "value1")); assertFalse(abstractRunnerHelper.fillResult(expectedResultSpy, resultWrapperSupplier, expressionEvaluator).getResult()); verify(expectedResultSpy, times(1)).setErrorValue(eq(VALUE)); reset(expectedResultSpy); resultWrapperAtomicReference.set(ValueWrapper.errorWithValidValue(VALUE, "value1")); ExpressionEvaluator expressionEvaluatorMock = mock(ExpressionEvaluator.class); when(expressionEvaluatorMock.fromObjectToExpression(any())).thenThrow(new IllegalArgumentException("Error")); assertFalse(abstractRunnerHelper.fillResult(expectedResultSpy, resultWrapperSupplier, expressionEvaluatorMock).getResult()); verify(expectedResultSpy, times(1)).setExceptionMessage(eq("Error")); reset(expectedResultSpy); resultWrapperAtomicReference.set(ValueWrapper.errorWithMessage("detailedError")); assertFalse(abstractRunnerHelper.fillResult(expectedResultSpy, resultWrapperSupplier, expressionEvaluator).getResult()); verify(expectedResultSpy, times(1)).setExceptionMessage(eq("detailedError")); }