static void setStaticGetter(final CompilationDTO<RegressionModel> compilationDTO,
                                final ClassOrInterfaceDeclaration modelTemplate,
                                final String nestedTable) {

        KiePMMLModelFactoryUtils.initStaticGetter(compilationDTO,
                                                  modelTemplate);
        final BlockStmt body = getMethodDeclarationBlockStmt(modelTemplate, GET_MODEL);
        final VariableDeclarator variableDeclarator =
                getVariableDeclarator(body, TO_RETURN).orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_IN_BODY, TO_RETURN, body)));

        final MethodCallExpr initializer = variableDeclarator.getInitializer()
                .orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_INITIALIZER_TEMPLATE,
                                                                      TO_RETURN, body)))
                .asMethodCallExpr();

        MethodCallExpr methodCallExpr = new MethodCallExpr();
        methodCallExpr.setScope(new NameExpr(nestedTable));
        methodCallExpr.setName(GETKIEPMML_TABLE);

        getChainedMethodCallExprFrom("withAbstractKiePMMLTable", initializer).setArgument(0, methodCallExpr);
    }
@Test
    void setStaticGetter() throws IOException {
        String nestedTable = "NestedTable";
        MINING_FUNCTION miningFunction = MINING_FUNCTION.byName(regressionModel.getMiningFunction().value());
        final ClassOrInterfaceDeclaration modelTemplate = MODEL_TEMPLATE.clone();
        final CommonCompilationDTO<RegressionModel> source =
                CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME,
                                                                       pmml,
                                                                       regressionModel,
                                                                       new PMMLCompilationContextMock(),
                                                                       "fileName");
        final RegressionCompilationDTO compilationDTO =
                RegressionCompilationDTO.fromCompilationDTORegressionTablesAndNormalizationMethod(source,
                                                                                                  new ArrayList<>(),
                                                                                                  regressionModel.getNormalizationMethod());
        KiePMMLRegressionModelFactory.setStaticGetter(compilationDTO,
                modelTemplate,
                nestedTable);
        Map<Integer, Expression> superInvocationExpressionsMap = new HashMap<>();
        superInvocationExpressionsMap.put(0, new NameExpr(String.format("\"%s\"", regressionModel.getModelName())));
        Map<String, Expression> assignExpressionMap = new HashMap<>();
        assignExpressionMap.put("targetField", new StringLiteralExpr(targetMiningField.getName()));
        assignExpressionMap.put("miningFunction",
                new NameExpr(miningFunction.getClass().getName() + "." + miningFunction.name()));
        assignExpressionMap.put("pmmlMODEL",
                new NameExpr(PMML_MODEL.class.getName() + "." + PMML_MODEL.REGRESSION_MODEL.name()));
        MethodCallExpr methodCallExpr = new MethodCallExpr();
        methodCallExpr.setScope(new NameExpr(nestedTable));
        methodCallExpr.setName(GETKIEPMML_TABLE);
        assignExpressionMap.put("regressionTable", methodCallExpr);
        MethodDeclaration retrieved = modelTemplate.getMethodsByName(GET_MODEL).get(0);
        String text = getFileContent(TEST_01_SOURCE);
        MethodDeclaration expected = JavaParserUtils.parseMethod(text);
        assertThat(expected.toString()).isEqualTo(retrieved.toString());
        assertThat(JavaParserUtils.equalsNode(expected, retrieved)).isTrue();
    }