static void setConstructor(final String segmentName,
                               final String generatedClassName,
                               final ConstructorDeclaration constructorDeclaration,
                               final String kiePMMLModelClass,
                               final boolean isInterpreted,
                               final double weight) {
        setConstructorSuperNameInvocation(generatedClassName, constructorDeclaration, segmentName);
        final BlockStmt body = constructorDeclaration.getBody();
        final ExplicitConstructorInvocationStmt superStatement =
                CommonCodegenUtils.getExplicitConstructorInvocationStmt(body)
                        .orElseThrow(() -> new KiePMMLException(String.format(MISSING_CONSTRUCTOR_IN_BODY, body)));
        final Expression instantiationExpression = getInstantiationExpression(kiePMMLModelClass, isInterpreted);
        String modelInstantiationString = instantiationExpression.toString();

        CommonCodegenUtils.setExplicitConstructorInvocationStmtArgument(superStatement, "model",
                                                                        modelInstantiationString);
        CommonCodegenUtils.setAssignExpressionValue(body, "weight", new DoubleLiteralExpr(weight));
        CommonCodegenUtils.setAssignExpressionValue(body, "id", new StringLiteralExpr(segmentName));
    }
@Test
    void setConstructorInterpreted() throws IOException {
        ConstructorDeclaration constructorDeclaration = MODEL_TEMPLATE.getDefaultConstructor().get();
        String segmentName = "SEGMENTNAME";
        String generatedClassName = "GENERATEDCLASSNAME";
        String kiePMMLModelClass = "KIEPMMLMODELCLASS";
        double weight = 12.22;
        KiePMMLSegmentFactory.setConstructor(segmentName,
                generatedClassName,
                constructorDeclaration,
                kiePMMLModelClass,
                true,
                weight);
        Map<Integer, Expression> superInvocationExpressionsMap = new HashMap<>();
        superInvocationExpressionsMap.put(0, new NameExpr(String.format("\"%s\"", segmentName)));
        ClassOrInterfaceType classOrInterfaceType = parseClassOrInterfaceType(kiePMMLModelClass);
        ObjectCreationExpr objectCreationExpr = new ObjectCreationExpr();
        objectCreationExpr.setType(classOrInterfaceType);
        superInvocationExpressionsMap.put(3, new NameExpr(objectCreationExpr.toString()));
        Map<String, Expression> assignExpressionMap = new HashMap<>();
        assignExpressionMap.put("weight", new DoubleLiteralExpr(weight));
        assignExpressionMap.put("id", new StringLiteralExpr(segmentName));
        String text = getFileContent(TEST_01_SOURCE);
        BlockStmt expected = JavaParserUtils.parseConstructorBlock(text);
        assertThat(JavaParserUtils.equalsNode(expected, constructorDeclaration.getBody())).isTrue();
    }