@Test
public void setConstructor() {

    Model model = new MiningModel();
    PMML_MODEL pmmlModel = PMML_MODEL.byName(model.getClass().getSimpleName());
    ConstructorDeclaration constructorDeclaration = MODEL_TEMPLATE.getDefaultConstructor().get();
    String targetField = "TARGET_FIELD";
    MINING_FUNCTION miningFunction = MINING_FUNCTION.CLASSIFICATION;
    String generatedClassName = "GENERATEDCLASSNAME";
    String segmentationClass = "SEGMENTATIONCLASS";
    KiePMMLMiningModelFactory.setConstructor(generatedClassName,
                                             constructorDeclaration,
                                             targetField,
                                             miningFunction,
                                             pmmlModel.name(),
                                             segmentationClass);
    Map<Integer, Expression> superInvocationExpressionsMap = new HashMap<>();
    superInvocationExpressionsMap.put(0, new NameExpr(String.format("\"%s\"", pmmlModel.name())));
    Map<String, Expression> assignExpressionMap = new HashMap<>();
    assignExpressionMap.put("targetField", new StringLiteralExpr(targetField));
    assignExpressionMap.put("miningFunction",
                            new NameExpr(miningFunction.getClass().getName() + "." + miningFunction.name()));
    assignExpressionMap.put("pmmlMODEL", new NameExpr(pmmlModel.getClass().getName() + "." + pmmlModel.name()));
    ClassOrInterfaceType kiePMMLSegmentationClass = parseClassOrInterfaceType(segmentationClass);
    ObjectCreationExpr objectCreationExpr = new ObjectCreationExpr();
    objectCreationExpr.setType(kiePMMLSegmentationClass);
    assignExpressionMap.put("segmentation", objectCreationExpr);
    assertTrue(commonEvaluateConstructor(constructorDeclaration, generatedClassName,
                                         superInvocationExpressionsMap, assignExpressionMap));
}