static void setStaticGetter(final CompilationDTO<ClusteringModel> compilationDTO,
                                final ClassOrInterfaceDeclaration modelTemplate) {
        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();

        ClusteringModel clusteringModel = compilationDTO.getModel();
        KiePMMLClusteringModel.ModelClass modelClass = modelClassFrom(clusteringModel.getModelClass());

        getChainedMethodCallExprFrom("withModelClass", initializer).setArgument(0, literalExprFrom(modelClass));
        getChainedMethodCallExprFrom("withComparisonMeasure", initializer).setArgument(0,
                                                                                       comparisonMeasureCreationExprFrom(clusteringModel.getComparisonMeasure()));
        Expression missingValueWeights = clusteringModel.getMissingValueWeights() != null ?
                missingValueWeightsCreationExprFrom(clusteringModel.getMissingValueWeights()) : new NullLiteralExpr();

        getChainedMethodCallExprFrom("withMissingValueWeights", initializer).setArgument(0, missingValueWeights);
    }
@Test
    void setStaticGetter() throws IOException {

        final ClassOrInterfaceDeclaration modelTemplate = MODEL_TEMPLATE.clone();
        final CommonCompilationDTO<ClusteringModel> compilationDTO =
                CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME,
                                                                       pmml,
                                                                       clusteringModel,
                                                                       new PMMLCompilationContextMock(), "fileName"); // fileName hardcoded inside TEST_01_SOURCE
        String expectedModelClass =
                KiePMMLClusteringModel.ModelClass.class.getCanonicalName() + "." + clusteringModel.getModelClass().name();
        ComparisonMeasure comparisonMeasure = clusteringModel.getComparisonMeasure();
        String expectedKind =
                KiePMMLComparisonMeasure.Kind.class.getCanonicalName() + "." + comparisonMeasure.getKind().name();
        String expectedAggregateFunction =
                KiePMMLAggregateFunction.class.getCanonicalName() + "." + AGGREGATE_FN_MAP.get(comparisonMeasure.getMeasure().getClass()).name();

        String expectedCompareFunction =
                KiePMMLCompareFunction.class.getCanonicalName() + "." + comparisonMeasure.getCompareFunction().name();
        String expectedTargetField =targetMiningField.getName();

        KiePMMLClusteringModelFactory.setStaticGetter(compilationDTO,
                modelTemplate);

        MethodDeclaration retrieved = modelTemplate.getMethodsByName(GET_MODEL).get(0);
        String text = String.format(getFileContent(TEST_01_SOURCE),
                expectedModelClass,
                expectedKind,
                expectedAggregateFunction,
                expectedCompareFunction,
                expectedTargetField);
        MethodDeclaration expected = JavaParserUtils.parseMethod(text);
        assertThat(JavaParserUtils.equalsNode(expected, retrieved)).isTrue();
    }