static BlockStmt getIntervalVariableDeclaration(final String variableName,
                                                        final Interval interval) {
        final MethodDeclaration methodDeclaration =
                INTERVAL_TEMPLATE.getMethodsByName(GETKIEPMMLINTERVAL).get(0).clone();
        final BlockStmt toReturn =
                methodDeclaration.getBody().orElseThrow(() -> new KiePMMLException(String.format(MISSING_BODY_TEMPLATE, methodDeclaration)));
        final VariableDeclarator variableDeclarator =
                getVariableDeclarator(toReturn, INTERVAL).orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_IN_BODY, INTERVAL, toReturn)));
        variableDeclarator.setName(variableName);
        final ObjectCreationExpr objectCreationExpr = variableDeclarator.getInitializer()
                .orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_INITIALIZER_TEMPLATE,
                                                                      INTERVAL, toReturn)))
                .asObjectCreationExpr();
        final Expression leftMarginExpr = getExpressionForObject(interval.getLeftMargin());
        final Expression rightMarginExpr = getExpressionForObject(interval.getRightMargin());
        final CLOSURE closure = CLOSURE.byName(interval.getClosure().value());
        final NameExpr closureExpr = new NameExpr(CLOSURE.class.getName() + "." + closure.name());
        objectCreationExpr.getArguments().set(0, leftMarginExpr);
        objectCreationExpr.getArguments().set(1, rightMarginExpr);
        objectCreationExpr.getArguments().set(2, closureExpr);
        return toReturn;
    }
@Test
    void getIntervalVariableDeclaration() 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);

        BlockStmt retrieved = KiePMMLIntervalFactory.getIntervalVariableDeclaration(variableName,
                                                                                    interval);
        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));
        assertThat(JavaParserUtils.equalsNode(expected, retrieved)).isTrue();
        List<Class<?>> imports = Arrays.asList(Collections.class, KiePMMLInterval.class);
        commonValidateCompilationWithImports(retrieved, imports);
    }