static BlockStmt getDerivedFieldVariableDeclaration(final String variableName, final DerivedField derivedField) {
        final MethodDeclaration methodDeclaration =
                DERIVED_FIELD_TEMPLATE.getMethodsByName(GETKIEPMMLDERIVEDFIELD).get(0).clone();
        final BlockStmt derivedFieldBody =
                methodDeclaration.getBody().orElseThrow(() -> new KiePMMLException(String.format(MISSING_BODY_TEMPLATE, methodDeclaration)));
        final VariableDeclarator variableDeclarator =
                getVariableDeclarator(derivedFieldBody, DERIVED_FIELD).orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_IN_BODY, DERIVED_FIELD, derivedFieldBody)));
        variableDeclarator.setName(variableName);
        final BlockStmt toReturn = new BlockStmt();
        String nestedVariableName = String.format(VARIABLE_NAME_TEMPLATE, variableName, 0);
        BlockStmt toAdd = getKiePMMLExpressionBlockStmt(nestedVariableName, derivedField.getExpression());
        toAdd.getStatements().forEach(toReturn::addStatement);
        final MethodCallExpr initializer = variableDeclarator.getInitializer()
                .orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_INITIALIZER_TEMPLATE, DERIVED_FIELD, derivedFieldBody)))
                .asMethodCallExpr();
        final MethodCallExpr builder = getChainedMethodCallExprFrom("builder", initializer);
        final Expression dataTypeExpression = getExpressionForDataType(derivedField.getDataType());
        final Expression opTypeExpression = getExpressionForOpType(derivedField.getOpType());
        builder.setArgument(0, new StringLiteralExpr(derivedField.getName()));
        builder.setArgument(2, dataTypeExpression);
        builder.setArgument(3, opTypeExpression);
        builder.setArgument(4, new NameExpr(nestedVariableName));
        getChainedMethodCallExprFrom("withDisplayName", initializer).setArgument(0, getExpressionForObject(derivedField.getDisplayName()));
        derivedFieldBody.getStatements().forEach(toReturn::addStatement);
        return toReturn;
    }
@Test
    void getDerivedFieldVariableDeclarationWithApply() throws IOException {
        final String variableName = "variableName";
        Constant constant = new Constant();
        constant.setValue(value1);
        FieldRef fieldRef = new FieldRef();
        fieldRef.setField("FIELD_REF");
        Apply apply = new Apply();
        apply.setFunction("/");
        apply.addExpressions(constant, fieldRef);
        DerivedField derivedField = new DerivedField();
        derivedField.setName(PARAM_1);
        derivedField.setDataType(DataType.DOUBLE);
        derivedField.setOpType(OpType.CONTINUOUS);
        derivedField.setExpression(apply);
        String dataType = getDATA_TYPEString(derivedField.getDataType());
        String opType = getOP_TYPEString(derivedField.getOpType());
        BlockStmt retrieved = KiePMMLDerivedFieldFactory.getDerivedFieldVariableDeclaration(variableName, derivedField);
        String text = getFileContent(TEST_03_SOURCE);
        Statement expected = JavaParserUtils
                .parseBlock(String.format(text,
                                          constant.getValue(),fieldRef.getField(),
                                          apply.getFunction(),
                                          apply.getInvalidValueTreatment().value(),
                                          variableName,derivedField.getName(),
                                          dataType,
                                          opType));
        assertThat(JavaParserUtils.equalsNode(expected, retrieved)).isTrue();
        List<Class<?>> imports = Arrays.asList(KiePMMLConstant.class,
                                               KiePMMLFieldRef.class,
                                               KiePMMLApply.class,
                                               KiePMMLDerivedField.class,
                                               Arrays.class,
                                               Collections.class);
        commonValidateCompilationWithImports(retrieved, imports);
    }