static void manageInvalidValues(final KiePMMLMiningField miningField, final ParameterInfo parameterInfo,
                                    final List<ParameterInfo> toRemove) {
        INVALID_VALUE_TREATMENT_METHOD invalidValueTreatmentMethod =
                miningField.getInvalidValueTreatmentMethod() != null ?
                        miningField.getInvalidValueTreatmentMethod()
                        : INVALID_VALUE_TREATMENT_METHOD.RETURN_INVALID;
        Object originalValue = parameterInfo.getValue();
        switch (invalidValueTreatmentMethod) {
            case RETURN_INVALID:
                throw new KiePMMLInputDataException("Invalid value " + originalValue + " for " + miningField.getName());
            case AS_MISSING:
                toRemove.add(parameterInfo);
                break;
            case AS_IS:
                break;
            case AS_VALUE:
                String invalidValueReplacement = miningField.getInvalidValueReplacement();
                if (invalidValueReplacement == null) {
                    throw new KiePMMLInputDataException("Missing required invalidValueReplacement for " + miningField.getName());
                } else {
                    Object requiredValue =
                            miningField.getDataType().getActualValue(invalidValueReplacement);
                    parameterInfo.setType(miningField.getDataType().getMappedClass());
                    parameterInfo.setValue(requiredValue);
                }
                break;
            default:
                throw new KiePMMLException("Unmanaged INVALID_VALUE_TREATMENT_METHOD " + invalidValueTreatmentMethod);
        }
    }
@Test
    void manageInvalidValuesReturnInvalid() {
        assertThatExceptionOfType(KiePMMLException.class).isThrownBy(() -> {
            final ParameterInfo parameterInfo = new ParameterInfo();
            // RETURN_INVALID
            KiePMMLMiningField miningField = KiePMMLMiningField.builder("FIELD", null)
                    .withDataType(DATA_TYPE.STRING)
                    .withInvalidValueTreatmentMethod(INVALID_VALUE_TREATMENT_METHOD.RETURN_INVALID)
                    .build();
            List<ParameterInfo> toRemove = new ArrayList<>();
            PreProcess.manageInvalidValues(miningField, parameterInfo, toRemove);
        });
    }