static void setConstructor(final TreeCompilationDTO compilationDTO,
                               final ClassOrInterfaceDeclaration modelTemplate,
                               final String fullNodeClassName) {
        KiePMMLModelFactoryUtils.init(compilationDTO,
                                      modelTemplate);
        final ConstructorDeclaration constructorDeclaration =
                modelTemplate.getDefaultConstructor().orElseThrow(() -> new KiePMMLInternalException(String.format(MISSING_DEFAULT_CONSTRUCTOR, modelTemplate.getName())));
        final BlockStmt body = constructorDeclaration.getBody();
        // set predicate function
        MethodReferenceExpr nodeReference = new MethodReferenceExpr();
        nodeReference.setScope(new NameExpr(fullNodeClassName));
        nodeReference.setIdentifier("evaluateNode");
        CommonCodegenUtils.setAssignExpressionValue(body, "nodeFunction", nodeReference);
    }
@Test
    void setConstructor() {
        String className = getSanitizedClassName(treeModel1.getModelName());
        CompilationUnit cloneCU = JavaParserUtils.getKiePMMLModelCompilationUnit(className, PACKAGE_NAME,
                KIE_PMML_TREE_MODEL_TEMPLATE_JAVA,
                KIE_PMML_TREE_MODEL_TEMPLATE);
        ClassOrInterfaceDeclaration modelTemplate = cloneCU.getClassByName(className)
                .orElseThrow(() -> new KiePMMLException(MAIN_CLASS_NOT_FOUND + ": " + className));
        String targetField = "whatIdo";
        String fullNodeClassName = "full.Node.ClassName";
        CommonCompilationDTO<TreeModel> source = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME,
                                                                                                        pmml1,
                                                                                                        treeModel1,
                                                                                                        new PMMLCompilationContextMock(),
                                                                                                        SOURCE_1);
        KiePMMLTreeModelFactory.setConstructor(TreeCompilationDTO.fromCompilationDTO(source),
                modelTemplate,
                fullNodeClassName);
        ConstructorDeclaration constructorDeclaration = modelTemplate
                .getDefaultConstructor()
                .orElseThrow(() -> new KiePMMLInternalException(String.format(MISSING_DEFAULT_CONSTRUCTOR,
                        modelTemplate.getName())))
                .clone();
        BlockStmt body = constructorDeclaration.getBody();
        // targetField
        Optional<AssignExpr> optRetrieved = CommonCodegenUtils.getAssignExpression(body, "targetField");
        assertThat(optRetrieved).isPresent();
        AssignExpr retrieved = optRetrieved.get();
        Expression initializer = retrieved.getValue();
        assertThat(initializer).isInstanceOf(StringLiteralExpr.class);
        String expected = String.format("\"%s\"", targetField);
        assertThat(initializer.toString()).isEqualTo(expected);
        // miningFunction
        optRetrieved = CommonCodegenUtils.getAssignExpression(body, "miningFunction");
        assertThat(optRetrieved).isPresent();
        retrieved = optRetrieved.get();
        initializer = retrieved.getValue();
        assertThat(initializer).isInstanceOf(NameExpr.class);
        MINING_FUNCTION miningFunction = MINING_FUNCTION.byName(treeModel1.getMiningFunction().value());
        expected = miningFunction.getClass().getName() + "." + miningFunction.name();
        assertThat(initializer.toString()).isEqualTo(expected);
        // pmmlMODEL
        optRetrieved = CommonCodegenUtils.getAssignExpression(body, "pmmlMODEL");
        assertThat(optRetrieved).isPresent();
        retrieved = optRetrieved.get();
        initializer = retrieved.getValue();
        assertThat(initializer).isInstanceOf(NameExpr.class);
        expected = PMML_MODEL.TREE_MODEL.getClass().getName() + "." + PMML_MODEL.TREE_MODEL.name();
        assertThat(initializer.toString()).isEqualTo(expected);
        // nodeFunction
        optRetrieved = CommonCodegenUtils.getAssignExpression(body, "nodeFunction");
        assertThat(optRetrieved).isPresent();
        retrieved = optRetrieved.get();
        initializer = retrieved.getValue();
        assertThat(initializer).isInstanceOf(MethodReferenceExpr.class);
        expected = fullNodeClassName;
        assertThat(((MethodReferenceExpr) initializer).getScope().toString()).isEqualTo(expected);
        expected = "evaluateNode";
        assertThat(((MethodReferenceExpr) initializer).getIdentifier()).isEqualTo(expected);
    }