static void manageMissingValues(final KiePMMLMiningField miningField, final PMMLRequestData requestData) {
        MISSING_VALUE_TREATMENT_METHOD missingValueTreatmentMethod =
                miningField.getMissingValueTreatmentMethod() != null ?
                        miningField.getMissingValueTreatmentMethod()
                        : MISSING_VALUE_TREATMENT_METHOD.RETURN_INVALID;
        switch (missingValueTreatmentMethod) {
            case RETURN_INVALID:
                throw new KiePMMLInputDataException("Missing required value for " + miningField.getName());
            case AS_IS:
            case AS_MEAN:
            case AS_MODE:
            case AS_MEDIAN:
            case AS_VALUE:
                String missingValueReplacement = miningField.getMissingValueReplacement();
                if (missingValueReplacement != null) {
                    Object requiredValue =
                            miningField.getDataType().getActualValue(missingValueReplacement);
                    requestData.addRequestParam(miningField.getName(), requiredValue);
                }
                break;
            default:
                throw new KiePMMLException("Unmanaged INVALID_VALUE_TREATMENT_METHOD " + missingValueTreatmentMethod);
        }
    }
@Test
    void manageMissingValuesNotReturnInvalid() {
        List<MISSING_VALUE_TREATMENT_METHOD> missingValueTreatmentMethods =
                Arrays.stream(MISSING_VALUE_TREATMENT_METHOD.values())
                        .filter(treatmentMethod -> !treatmentMethod.equals(MISSING_VALUE_TREATMENT_METHOD.RETURN_INVALID))
                        .collect(Collectors.toList());
        final String fieldName = "FIELD";
        missingValueTreatmentMethods.forEach(missingValueTreatmentMethod -> {
            KiePMMLMiningField miningField = KiePMMLMiningField.builder(fieldName, null)
                    .withMissingValueTreatmentMethod(missingValueTreatmentMethod)
                    .build();
            PMMLRequestData pmmlRequestData = new PMMLRequestData();
            PreProcess.manageMissingValues(miningField, pmmlRequestData);
            assertThat(pmmlRequestData.getRequestParams()).isEmpty();
            String missingValueReplacement = "REPLACEMENT";
            miningField = KiePMMLMiningField.builder(fieldName, null)
                    .withDataType(DATA_TYPE.STRING)
                    .withMissingValueTreatmentMethod(missingValueTreatmentMethod)
                    .withMissingValueReplacement(missingValueReplacement)
                    .build();
            pmmlRequestData = new PMMLRequestData();
            PreProcess.manageMissingValues(miningField, pmmlRequestData);
            assertThat(pmmlRequestData.getRequestParams()).hasSize(1);
            assertThat(pmmlRequestData.getMappedRequestParams()).containsKey(fieldName);
            ParameterInfo parameterInfo = pmmlRequestData.getMappedRequestParams().get(fieldName);
            assertThat(parameterInfo.getValue()).isEqualTo(missingValueReplacement);
            assertThat(parameterInfo.getType()).isEqualTo(String.class);
        });
    }