KiePMMLSegmentFactory { public static KiePMMLSegment getSegment(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final Segment segment, final KnowledgeBuilder kBuilder) { logger.debug(GET_SEGMENT, segment); return KiePMMLSegment.builder(segment.getId(), getKiePMMLExtensions(segment.getExtensions()), getPredicate(segment.getPredicate(), dataDictionary), getFromCommonDataAndTransformationDictionaryAndModel(dataDictionary, transformationDictionary, segment.getModel(), kBuilder).orElseThrow(() -> new KiePMMLException("Failed to get the KiePMMLModel for segment " + segment.getModel().getModelName()))) .withWeight(segment.getWeight().doubleValue()) .build(); } 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 getSegment() { final Segment segment = MINING_MODEL.getSegmentation().getSegments().get(0); final KiePMMLSegment retrieved = KiePMMLSegmentFactory.getSegment(DATA_DICTIONARY, TRANSFORMATION_DICTIONARY, segment, KNOWLEDGE_BUILDER); commonEvaluateSegment(retrieved, segment); }