static BlockStmt getTextIndexNormalizationVariableDeclaration(final String variableName,
                                                                  final TextIndexNormalization textIndexNormalization) {
        if (textIndexNormalization.getInlineTable() == null && textIndexNormalization.getTableLocator() != null) {
            throw new UnsupportedOperationException("TableLocator not supported, yet");
        }
        final MethodDeclaration methodDeclaration =
                TEXTINDEXNORMALIZATION_TEMPLATE.getMethodsByName(GETKIEPMMLTEXTINDEXNORMALIZATION).get(0).clone();
        final BlockStmt textIndexNormalizationBody =
                methodDeclaration.getBody().orElseThrow(() -> new KiePMMLException(String.format(MISSING_BODY_TEMPLATE, methodDeclaration)));
        final VariableDeclarator variableDeclarator =
                getVariableDeclarator(textIndexNormalizationBody, TEXTINDEXNORMALIZATION).orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_IN_BODY, TEXTINDEXNORMALIZATION, textIndexNormalizationBody)));
        variableDeclarator.setName(variableName);
        String inlineTableVariableName = String.format("%s_InlineTable", variableName);
        final BlockStmt toReturn = new BlockStmt();
        BlockStmt toAdd = getInlineTableVariableDeclaration(inlineTableVariableName,
                                                            textIndexNormalization.getInlineTable());
        toAdd.getStatements().forEach(toReturn::addStatement);
        final MethodCallExpr initializer = variableDeclarator.getInitializer()
                .orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_INITIALIZER_TEMPLATE,
                                                                      TEXTINDEXNORMALIZATION, textIndexNormalizationBody)))
                .asMethodCallExpr();
        final MethodCallExpr builder = getChainedMethodCallExprFrom("builder", initializer);
        final StringLiteralExpr nameExpr = new StringLiteralExpr(variableName);
        builder.setArgument(0, nameExpr);
        getChainedMethodCallExprFrom("withInField", initializer).setArgument(0,
                                                                             getExpressionForObject(textIndexNormalization.getInField()));
        getChainedMethodCallExprFrom("withOutField", initializer).setArgument(0,
                                                                              getExpressionForObject(textIndexNormalization.getOutField()));
        getChainedMethodCallExprFrom("withKiePMMLInlineTable", initializer).setArgument(0,
                                                                                        new NameExpr(inlineTableVariableName));
        getChainedMethodCallExprFrom("withRegexField", initializer).setArgument(0,
                                                                              getExpressionForObject(textIndexNormalization.getRegexField()));
        getChainedMethodCallExprFrom("withRecursive", initializer).setArgument(0,
                                                                                getExpressionForObject(textIndexNormalization.isRecursive()));
        BooleanLiteralExpr isCaseSensitiveExpression = textIndexNormalization.isCaseSensitive() != null ? (BooleanLiteralExpr) getExpressionForObject(textIndexNormalization.isCaseSensitive()) : new BooleanLiteralExpr(false);
        getChainedMethodCallExprFrom("withIsCaseSensitive", initializer).setArgument(0, isCaseSensitiveExpression);
        getChainedMethodCallExprFrom("withMaxLevenshteinDistance", initializer).setArgument(0,
                                                                               getExpressionForObject(textIndexNormalization.getMaxLevenshteinDistance()));
        Expression wordSeparatorCharacterREExpression;
        if (textIndexNormalization.getWordSeparatorCharacterRE() != null) {
            String wordSeparatorCharacterRE = StringEscapeUtils.escapeJava(textIndexNormalization.getWordSeparatorCharacterRE());
            wordSeparatorCharacterREExpression = new StringLiteralExpr(wordSeparatorCharacterRE);
        } else {
            wordSeparatorCharacterREExpression = new NullLiteralExpr();
        }
        getChainedMethodCallExprFrom("withWordSeparatorCharacterRE", initializer).setArgument(0, wordSeparatorCharacterREExpression);
        BooleanLiteralExpr tokenizeExpression = textIndexNormalization.isTokenize() != null ? (BooleanLiteralExpr) getExpressionForObject(textIndexNormalization.isTokenize()) : new BooleanLiteralExpr(false);
        getChainedMethodCallExprFrom("withTokenize", initializer).setArgument(0, tokenizeExpression);
        textIndexNormalizationBody.getStatements().forEach(toReturn::addStatement);
        return toReturn;
    }
@Test
    void getTextIndexNormalizationVariableDeclaration() throws IOException {
        String variableName = "variableName";
        BlockStmt retrieved =
                KiePMMLTextIndexNormalizationFactory.getTextIndexNormalizationVariableDeclaration(variableName,
                                                                                                  TEXTINDEXNORMALIZATION);
        String text = getFileContent(TEST_01_SOURCE);
        Statement expected = JavaParserUtils.parseBlock(String.format(text, variableName));
        assertThat(JavaParserUtils.equalsNode(expected, retrieved)).isTrue();
        List<Class<?>> imports = Arrays.asList(Arrays.class, Collections.class, Collectors.class,
                                               KiePMMLInlineTable.class, KiePMMLTextIndexNormalization.class,
                                               KiePMMLRow.class, Map.class, Stream.class);
        commonValidateCompilationWithImports(retrieved, imports);
    }