static void populateMissingTargetFieldInSegment(final MiningSchema parentMiningSchema, final Model childrenModel) {
        List<MiningField> parentTargetFields = getMiningTargetFields(parentMiningSchema.getMiningFields());
        List<MiningField> childrenTargetFields = getMiningTargetFields(childrenModel.getMiningSchema().getMiningFields());
        if (childrenTargetFields.isEmpty()) {
            childrenModel.getMiningSchema().addMiningFields(parentTargetFields.toArray(new MiningField[parentTargetFields.size()]));
        }
    }
@Test
    void populateMissingTargetFieldInSegment() 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;
        Model toPopulate = miningModel.getSegmentation().getSegments().get(0).getModel();
        assertThat(getMiningTargetFields(toPopulate.getMiningSchema())).isEmpty();
        KiePMMLUtil.populateMissingTargetFieldInSegment(retrieved.getMiningSchema(), toPopulate);
        List<MiningField> childrenTargetFields = getMiningTargetFields(toPopulate.getMiningSchema());
        assertThat(childrenTargetFields).isNotEmpty();
        getMiningTargetFields(miningModel.getMiningSchema()).forEach(parentTargetField -> assertThat(childrenTargetFields).contains(parentTargetField));
    }