static void populateCorrectMiningModel(final MiningModel miningModel) {
        final List<Segment> segments = miningModel.getSegmentation().getSegments();
        for (int i = 0; i < segments.size(); i++) {
            Segment segment = segments.get(i);
            populateCorrectSegmentId(segment, miningModel.getModelName(), i);
            Model model = segment.getModel();
            populateMissingSegmentModelName(model, segment.getId());
            populateMissingTargetFieldInSegment(miningModel.getMiningSchema(), model);
            populateMissingPredictedOutputFieldTarget(model);
            if (model instanceof MiningModel) {
                populateCorrectMiningModel((MiningModel) segment.getModel());
            }
        }
    }
@Test
    void populateCorrectMiningModel() throws Exception {
        final InputStream inputStream = getFileInputStream(NO_MODELNAME_NO_SEGMENT_ID_NOSEGMENT_TARGET_FIELD_SAMPLE);
        final PMML pmml = org.jpmml.model.PMMLUtil.unmarshal(inputStream);
        final Model retrieved = pmml.getModels().get(0);
        assertThat(retrieved).isInstanceOf(MiningModel.class);
        MiningModel miningModel = (MiningModel) retrieved;
        miningModel.getSegmentation().getSegments().forEach(segment -> {
            assertThat(segment.getId()).isNull();
            assertThat(segment.getModel().getModelName()).isNull();
            assertThat(getMiningTargetFields(segment.getModel().getMiningSchema())).isEmpty();
        });
        KiePMMLUtil.populateCorrectMiningModel(miningModel);
        miningModel.getSegmentation().getSegments().forEach(segment -> {
            assertThat(segment.getId()).isNotNull();
            assertThat(segment.getModel().getModelName()).isNotNull();
            assertThat(getMiningTargetFields(segment.getModel().getMiningSchema())).isNotEmpty();
        });
    }