KiePMMLSegmentFactory { public static Map<String, String> getSegmentSourcesMap( final String parentPackageName, final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final Segment segment, final KnowledgeBuilder kBuilder, final List<KiePMMLModel> nestedModels) { logger.debug(GET_SEGMENT, segment); final String packageName = getSanitizedPackageName(parentPackageName + "." + segment.getId()); final KiePMMLModel nestedModel = getFromCommonDataAndTransformationDictionaryAndModelFromPlugin( packageName, dataDictionary, transformationDictionary, segment.getModel(), kBuilder) .orElseThrow(() -> new KiePMMLException("Failed to get the KiePMMLModel for segment " + segment.getModel().getModelName())); if (!(nestedModel instanceof HasSourcesMap)) { throw new KiePMMLException("Retrieved KiePMMLModel for segment " + segment.getModel().getModelName() + " " + "does not implement HasSources"); } nestedModels.add(nestedModel); return getSegmentSourcesMap(packageName, dataDictionary, segment); } private  KiePMMLSegmentFactory(); static List<KiePMMLSegment> getSegments(final DataDictionary dataDictionary,
                                                   final TransformationDictionary transformationDictionary,
                                                   final List<Segment> segments,
                                                   final KnowledgeBuilder kBuilder); static KiePMMLSegment getSegment(final DataDictionary dataDictionary,
                                            final TransformationDictionary transformationDictionary,
                                            final Segment segment,
                                            final KnowledgeBuilder kBuilder); static Map<String, String> getSegmentsSourcesMap(final String parentPackageName,
                                                            final DataDictionary dataDictionary,
                                                            final TransformationDictionary transformationDictionary,
                                                            final List<Segment> segments,
                                                            final KnowledgeBuilder kBuilder,
                                                            final List<KiePMMLModel> nestedModels); static Map<String, String> getSegmentSourcesMap(
            final String parentPackageName,
            final DataDictionary dataDictionary,
            final TransformationDictionary transformationDictionary,
            final Segment segment,
            final KnowledgeBuilder kBuilder,
            final List<KiePMMLModel> nestedModels); static Map<String, String> getSegmentSourcesMap(
            final String packageName,
            final DataDictionary dataDictionary,
            final Segment segment);  }
@Test public void getSegmentSourcesMap() { final Segment segment = MINING_MODEL.getSegmentation().getSegments().get(0); final String packageName = "packagename"; final List<KiePMMLModel> nestedModels = new ArrayList<>(); final Map<String, String> retrieved = KiePMMLSegmentFactory.getSegmentSourcesMap(packageName, DATA_DICTIONARY, TRANSFORMATION_DICTIONARY, segment, KNOWLEDGE_BUILDER, nestedModels); commonEvaluateNestedModels(nestedModels); commonEvaluateMap(retrieved, segment); }