@SuppressWarnings("unchecked")
    public void updateValues(Object object) {
        validateFields(object);
        for (ScenarioStateField field : getScenarioFields(object)) {
            Object value = getValue(field);

            if (value != null) {
                try {
                    field.getField().set(object, value);
                } catch (IllegalAccessException e) {
                    throw new RuntimeException("Error while updating field " + field.getField(), e);
                }

                log.debug("Setting field {} to value {}", field.getField(), value);
            } else if (field.isRequired()) {
                throw new JGivenMissingRequiredScenarioStateException(field.getField());
            }
        }
    }
@throws JGivenMissingRequiredScenarioStateException in case a field requires
                                                    a value and the value is not present
jgiven-core/src/main/java/com/tngtech/jgiven/impl/inject/ValueInjector.java