static BlockStmt getDiscretizeVariableDeclaration(final String variableName, final Discretize discretize) {
        final MethodDeclaration methodDeclaration =
                DISCRETIZE_TEMPLATE.getMethodsByName(GETKIEPMMLDISCRETIZE).get(0).clone();
        final BlockStmt discretizeBody =
                methodDeclaration.getBody().orElseThrow(() -> new KiePMMLException(String.format(MISSING_BODY_TEMPLATE, methodDeclaration)));
        final VariableDeclarator variableDeclarator =
                getVariableDeclarator(discretizeBody, DISCRETIZE).orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_IN_BODY, DISCRETIZE, discretizeBody)));
        variableDeclarator.setName(variableName);
        final BlockStmt toReturn = new BlockStmt();
        int counter = 0;
        final NodeList<Expression> arguments = new NodeList<>();
        for (DiscretizeBin discretizeBin : discretize.getDiscretizeBins()) {
            String nestedVariableName = String.format(VARIABLE_NAME_TEMPLATE, variableName, counter);
            arguments.add(new NameExpr(nestedVariableName));
            BlockStmt toAdd = getDiscretizeBinVariableDeclaration(nestedVariableName, discretizeBin);
            toAdd.getStatements().forEach(toReturn::addStatement);
            counter++;
        }
        final ObjectCreationExpr objectCreationExpr = variableDeclarator.getInitializer()
                .orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_INITIALIZER_TEMPLATE,
                                                                      DISCRETIZE, toReturn)))
                .asObjectCreationExpr();
        final Expression nameExpr = new StringLiteralExpr(discretize.getField());
        final Expression mapMissingToExpr = getExpressionForObject(discretize.getMapMissingTo());
        final Expression defaultValueExpr = getExpressionForObject(discretize.getDefaultValue());

        final Expression dataTypeExpression = getExpressionForDataType(discretize.getDataType());
        objectCreationExpr.getArguments().set(0, nameExpr);
        objectCreationExpr.getArguments().get(2).asMethodCallExpr().setArguments(arguments);
        objectCreationExpr.getArguments().set(3, mapMissingToExpr);
        objectCreationExpr.getArguments().set(4, defaultValueExpr);
        objectCreationExpr.getArguments().set(5, dataTypeExpression);
        discretizeBody.getStatements().forEach(toReturn::addStatement);
        return toReturn;
    }
@Test
    void getDiscretizeVariableDeclaration() throws IOException {
        String variableName = "variableName";
        Discretize discretize = new Discretize();
        discretize.setField(NAME);
        discretize.setDataType(dataType);
        discretize.setMapMissingTo(MAP_MISSING_TO);
        discretize.setDefaultValue(DEFAULTVALUE);
        discretize.addDiscretizeBins(discretizeBins.toArray(new DiscretizeBin[0]));

        BlockStmt retrieved = KiePMMLDiscretizeFactory.getDiscretizeVariableDeclaration(variableName,
                                                                                        discretize);
        String dataTypeString = getDATA_TYPEString(discretize.getDataType());
        String text = getFileContent(TEST_01_SOURCE);
        Statement expected = JavaParserUtils.parseBlock(String.format(text, variableName, NAME, MAP_MISSING_TO,
                                                                      DEFAULTVALUE, dataTypeString));
        assertThat(JavaParserUtils.equalsNode(expected, retrieved)).isTrue();
        List<Class<?>> imports = Arrays.asList(Arrays.class, Collections.class, KiePMMLDiscretize.class,
                                               KiePMMLDiscretizeBin.class, KiePMMLInterval.class);
        commonValidateCompilationWithImports(retrieved, imports);
    }