static Map<String, SerializableFunction<String, Double>> getCategoricalPredictorsMap(final List<CategoricalPredictor> categoricalPredictors) {
        final Map<String, List<CategoricalPredictor>> groupedCollectors = categoricalPredictors.stream()
                .collect(groupingBy(categoricalPredictor ->categoricalPredictor.getField()));
        return groupedCollectors.entrySet().stream()
                .map(entry -> {
                    Map<String, Double> groupedCategoricalPredictorMap =
                            getGroupedCategoricalPredictorMap(entry.getValue());
                    SerializableFunction<String, Double> function =
                            input -> KiePMMLRegressionTable.evaluateCategoricalPredictor(input,
                                                                                         groupedCategoricalPredictorMap);
                    return new AbstractMap.SimpleEntry<>(entry.getKey(),
                                                         function);
                })
                .collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey,
                                          AbstractMap.SimpleEntry::getValue));
    }
@Test
    void getCategoricalPredictorsMap() {
        final List<CategoricalPredictor> categoricalPredictors = IntStream.range(0, 3).mapToObj(index ->
                IntStream.range(0,
                        3).mapToObj(i -> {
                    String predictorName = "predictorName-" + index;
                    double coefficient = 1.23 * i;
                    return PMMLModelTestUtils.getCategoricalPredictor(predictorName, i, coefficient);
                })
                        .collect(Collectors.toList())).reduce((categoricalPredictors1, categoricalPredictors2) -> {
            List<CategoricalPredictor> toReturn = new ArrayList<>();
            toReturn.addAll(categoricalPredictors1);
            toReturn.addAll(categoricalPredictors2);
            return toReturn;
        }).get();
        Map<String, SerializableFunction<String, Double>> retrieved =
                KiePMMLRegressionTableFactory.getCategoricalPredictorsMap(categoricalPredictors);
        final Map<String, List<CategoricalPredictor>> groupedCollectors = categoricalPredictors.stream()
                .collect(groupingBy(categoricalPredictor ->categoricalPredictor.getField()));
        assertThat(retrieved).hasSameSizeAs(groupedCollectors);
        groupedCollectors.keySet().forEach(predictName -> assertThat(retrieved).containsKey(predictName));
    }