KiePMMLTreeModelFactory { static void setConstructor(final TreeModel treeModel, final ConstructorDeclaration constructorDeclaration, final SimpleName modelName) { setConstructorSuperNameInvocation(modelName.asString(), constructorDeclaration, treeModel.getModelName()); final BlockStmt body = constructorDeclaration.getBody(); final ExplicitConstructorInvocationStmt superStatement = CommonCodegenUtils.getExplicitConstructorInvocationStmt(body) .orElseThrow(() -> new KiePMMLException(String.format(MISSING_CONSTRUCTOR_IN_BODY, body))); CommonCodegenUtils.setExplicitConstructorInvocationArgument(superStatement, "algorithmName", String.format("\"%s\"", treeModel.getAlgorithmName())); } private  KiePMMLTreeModelFactory(); static KiePMMLTreeModel getKiePMMLTreeModel(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final TreeModel model, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap); static Map<String, String> getKiePMMLTreeModelSourcesMap(final DataDictionary dataDictionary,
                                                                    final TransformationDictionary transformationDictionary,
                                                                    final TreeModel model,
                                                                    final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap,
                                                                    final String packageName); static KiePMMLDroolsAST getKiePMMLDroolsAST(final DataDictionary dataDictionary,
                                                       final TreeModel model,
                                                       final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap,
                                                       final List<KiePMMLDroolsType> types);  }
@Test public void setConstructor() { ConstructorDeclaration constructorDeclaration = classOrInterfaceDeclaration.getDefaultConstructor().get(); SimpleName simpleName = new SimpleName("SIMPLENAME"); KiePMMLTreeModelFactory.setConstructor(treeModel, constructorDeclaration, simpleName); Map<Integer, Expression> superInvocationExpressionsMap = new HashMap<>(); superInvocationExpressionsMap.put(0, new NameExpr(String.format("\"%s\"", treeModel.getModelName()))); superInvocationExpressionsMap.put(2, new NameExpr(String.format("\"%s\"", treeModel.getAlgorithmName()))); Map<String, Expression> assignExpressionMap = new HashMap<>(); assignExpressionMap.put("targetField", new NameExpr("targetField")); assignExpressionMap.put("miningFunction", new NullLiteralExpr()); assignExpressionMap.put("pmmlMODEL", new NullLiteralExpr()); assertTrue(commonEvaluateConstructor(constructorDeclaration, simpleName.asString(), superInvocationExpressionsMap, assignExpressionMap)); }