static void populateWithGroupedCategoricalPredictorMap(final List<CategoricalPredictor> categoricalPredictors,
                                                           final BlockStmt toPopulate,
                                                           final String categoricalPredictorMapName) {

        final VariableDeclarator categoricalMapDeclarator =
                new VariableDeclarator(getTypedClassOrInterfaceTypeByTypeNames(Map.class.getName(),
                                                                               Arrays.asList(String.class.getSimpleName(),
                                                                                             Double.class.getSimpleName())),
                                       categoricalPredictorMapName);
        final ObjectCreationExpr categoricalMapInitializer = new ObjectCreationExpr();
        categoricalMapInitializer.setType(getTypedClassOrInterfaceTypeByTypeNames(HashMap.class.getName(),
                                                                                  Arrays.asList(String.class.getSimpleName(),
                                                                                                Double.class.getSimpleName())));
        categoricalMapDeclarator.setInitializer(categoricalMapInitializer);
        final VariableDeclarationExpr categoricalMapDeclarationExpr =
                new VariableDeclarationExpr(categoricalMapDeclarator);
        toPopulate.addStatement(categoricalMapDeclarationExpr);
        final Map<String, Expression> mapExpressions = new LinkedHashMap<>();
        categoricalPredictors.forEach(categoricalPredictor -> mapExpressions.put(categoricalPredictor.getValue().toString(),
                                                                                 getExpressionForObject(categoricalPredictor.getCoefficient().doubleValue())));
        addMapPopulationExpressions(mapExpressions, toPopulate, categoricalPredictorMapName);
    }
@Test
    void populateWithGroupedCategoricalPredictorMap() throws IOException {
        final List<CategoricalPredictor> categoricalPredictors = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            String predictorName = "predictorName-" + i;
            double coefficient = 1.23 * i;
            categoricalPredictors.add(PMMLModelTestUtils.getCategoricalPredictor(predictorName, i, coefficient));
        }
        final BlockStmt toPopulate = new BlockStmt();
        final String categoricalPredictorMapName = "categoricalPredictorMapName";
        KiePMMLRegressionTableFactory.populateWithGroupedCategoricalPredictorMap(categoricalPredictors,
                toPopulate,
                categoricalPredictorMapName);
        String text = getFileContent(TEST_04_SOURCE);
        BlockStmt expected = JavaParserUtils.parseBlock(String.format(text,
                categoricalPredictorMapName,
                categoricalPredictors.get(0).getValue(),
                categoricalPredictors.get(0).getCoefficient(),
                categoricalPredictors.get(1).getValue(),
                categoricalPredictors.get(1).getCoefficient(),
                categoricalPredictors.get(2).getValue(),
                categoricalPredictors.get(2).getCoefficient()));
        assertThat(JavaParserUtils.equalsNode(expected, toPopulate)).isTrue();
    }