static BlockStmt getDiscretizeBinVariableDeclaration(final String variableName,
                                                        final DiscretizeBin discretizeBin) {
        final MethodDeclaration methodDeclaration =
                DISCRETIZE_BIN_TEMPLATE.getMethodsByName(GETKIEPMMLDISCRETIZE_BIN).get(0).clone();
        final BlockStmt discretizeBinBody =
                methodDeclaration.getBody().orElseThrow(() -> new KiePMMLException(String.format(MISSING_BODY_TEMPLATE, methodDeclaration)));
        final VariableDeclarator variableDeclarator =
                getVariableDeclarator(discretizeBinBody, DISCRETIZE_BIN).orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_IN_BODY, DISCRETIZE_BIN, discretizeBinBody)));
        variableDeclarator.setName(variableName);
        final BlockStmt toReturn = new BlockStmt();
        String nestedVariableName = String.format("%s_Interval", variableName);

        BlockStmt toAdd = getIntervalVariableDeclaration(nestedVariableName, discretizeBin.getInterval());
        toAdd.getStatements().forEach(toReturn::addStatement);


        final ObjectCreationExpr objectCreationExpr = variableDeclarator.getInitializer()
                .orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_INITIALIZER_TEMPLATE,
                                                                      DISCRETIZE_BIN, discretizeBinBody)))
                .asObjectCreationExpr();

        final Expression nameExpr = new StringLiteralExpr(variableName);
        final Expression binValueExpr = getExpressionForObject(discretizeBin.getBinValue());
        final NameExpr intervalExpr = new NameExpr(nestedVariableName);
        objectCreationExpr.getArguments().set(0, nameExpr);
        objectCreationExpr.getArguments().set(2, binValueExpr);
        objectCreationExpr.getArguments().set(3, intervalExpr);
        discretizeBinBody.getStatements().forEach(toReturn::addStatement);
        return toReturn;
    }
@Test
    void getDiscretizeBinVariableDeclaration() throws IOException {
        String variableName = "variableName";
        double leftMargin = 45.32;

        Interval interval = new Interval();
        interval.setLeftMargin(leftMargin);
        interval.setRightMargin(null);
        interval.setClosure(Interval.Closure.CLOSED_OPEN);

        String binValue = "binValue";

        DiscretizeBin discretizeBin = new DiscretizeBin();
        discretizeBin.setBinValue(binValue);
        discretizeBin.setInterval(interval);

        BlockStmt retrieved = KiePMMLDiscretizeBinFactory.getDiscretizeBinVariableDeclaration(variableName,
                                                                                              discretizeBin);
        String closureString =
                CLOSURE.class.getName() + "." + CLOSURE.byName(interval.getClosure().value()).name();
        String text = getFileContent(TEST_01_SOURCE);
        Statement expected = JavaParserUtils.parseBlock(String.format(text, variableName, leftMargin, closureString,
                                                                      binValue));
        assertThat(JavaParserUtils.equalsNode(expected, retrieved)).isTrue();
        List<Class<?>> imports = Arrays.asList(Collections.class, KiePMMLDiscretizeBin.class, KiePMMLInterval.class);
        commonValidateCompilationWithImports(retrieved, imports);
    }