static BlockStmt getCompoundPredicateVariableDeclaration(final String variableName,
                                                             final CompoundPredicate compoundPredicate,
                                                             final List<Field<?>> fields) {
        final MethodDeclaration methodDeclaration =
                COMPOUND_PREDICATE_TEMPLATE.getMethodsByName(GETKIEPMMLCOMPOUNDPREDICATE).get(0).clone();
        final BlockStmt compoundPredicateBody =
                methodDeclaration.getBody().orElseThrow(() -> new KiePMMLException(String.format(MISSING_BODY_TEMPLATE, methodDeclaration)));
        final VariableDeclarator variableDeclarator =
                getVariableDeclarator(compoundPredicateBody, COMPOUND_PREDICATE).orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_IN_BODY, COMPOUND_PREDICATE, compoundPredicateBody)));
        variableDeclarator.setName(variableName);
        final BlockStmt toReturn = new BlockStmt();
        int counter = 0;
        final NodeList<Expression> arguments = new NodeList<>();
        for (Predicate predicate : compoundPredicate.getPredicates()) {
            String nestedVariableName = String.format(VARIABLE_NAME_TEMPLATE, variableName, counter);
            arguments.add(new NameExpr(nestedVariableName));
            BlockStmt toAdd = getKiePMMLPredicate(nestedVariableName, predicate, fields);
            toAdd.getStatements().forEach(toReturn::addStatement);
            counter ++;
        }
        final BOOLEAN_OPERATOR booleanOperator = BOOLEAN_OPERATOR.byName(compoundPredicate.getBooleanOperator().value());
        final NameExpr booleanOperatorExpr = new NameExpr(BOOLEAN_OPERATOR.class.getName() + "." + booleanOperator.name());
        final MethodCallExpr initializer = variableDeclarator.getInitializer()
                .orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_INITIALIZER_TEMPLATE, COMPOUND_PREDICATE, compoundPredicateBody)))
                .asMethodCallExpr();
        final MethodCallExpr builder = getChainedMethodCallExprFrom("builder", initializer);
        builder.setArgument(1, booleanOperatorExpr);
        getChainedMethodCallExprFrom("asList", initializer).setArguments(arguments);
        compoundPredicateBody.getStatements().forEach(toReturn::addStatement);
        return toReturn;
    }
@Test
    void getCompoundPredicateVariableDeclaration() throws IOException {
        String variableName = "variableName";
        SimplePredicate simplePredicate1 = getSimplePredicate(PARAM_1, value1, operator1);
        SimplePredicate simplePredicate2 = getSimplePredicate(PARAM_2, value2, operator2);

        Array.Type arrayType = Array.Type.STRING;
        List<String> values = getStringObjects(arrayType, 4);
        SimpleSetPredicate simpleSetPredicate = getSimpleSetPredicate(values, arrayType,
                                                                      SimpleSetPredicate.BooleanOperator.IS_IN);
        CompoundPredicate compoundPredicate = new CompoundPredicate();
        compoundPredicate.setBooleanOperator(CompoundPredicate.BooleanOperator.AND);
        compoundPredicate.getPredicates().add(0, simplePredicate1);
        compoundPredicate.getPredicates().add(1, simplePredicate2);
        compoundPredicate.getPredicates().add(2, simpleSetPredicate);

        DataField dataField1 = new DataField();
        dataField1.setName(simplePredicate1.getField());
        dataField1.setDataType(DataType.DOUBLE);
        DataField dataField2 = new DataField();
        dataField2.setName(simplePredicate2.getField());
        dataField2.setDataType(DataType.DOUBLE);
        DataField dataField3 = new DataField();
        dataField3.setName(simpleSetPredicate.getField());
        dataField3.setDataType(DataType.DOUBLE);
        DataDictionary dataDictionary = new DataDictionary();
        dataDictionary.addDataFields(dataField1, dataField2, dataField3);

        String booleanOperatorString =
                BOOLEAN_OPERATOR.class.getName() + "." + BOOLEAN_OPERATOR.byName(compoundPredicate.getBooleanOperator().value()).name();
        String valuesString = values.stream()
                .map(valueString -> "\"" + valueString + "\"")
                .collect(Collectors.joining(","));

        final List<Field<?>> fields = getFieldsFromDataDictionary(dataDictionary);
        BlockStmt retrieved = KiePMMLCompoundPredicateFactory.getCompoundPredicateVariableDeclaration(variableName,
                                                                                                      compoundPredicate, fields);
        String text = getFileContent(TEST_01_SOURCE);
        Statement expected = JavaParserUtils.parseBlock(String.format(text, variableName,
                                                                      valuesString,
                                                                      booleanOperatorString));
        assertThat(JavaParserUtils.equalsNode(expected, retrieved)).isTrue();
        List<Class<?>> imports = Arrays.asList(KiePMMLCompoundPredicate.class, KiePMMLSimplePredicate.class,
                                               KiePMMLSimpleSetPredicate.class, Arrays.class, Collections.class);
        commonValidateCompilationWithImports(retrieved, imports);
    }