public static Optional<String> getTargetFieldName(final List<Field<?>> fields, Model model) {
        return getTargetFields(fields, model).stream().map(KiePMMLNameOpType::getName).findFirst();
    }
@Test
    void getTargetFieldName() {
        final String fieldName = "fieldName";
        MiningField.UsageType usageType = MiningField.UsageType.ACTIVE;
        MiningField miningField = getMiningField(fieldName, usageType);
        final DataField dataField = getDataField(fieldName, OpType.CATEGORICAL, DataType.STRING);
        final DataDictionary dataDictionary = new DataDictionary();
        dataDictionary.addDataFields(dataField);
        MiningSchema miningSchema = new MiningSchema();
        miningSchema.addMiningFields(miningField);
        final Model model = new RegressionModel();
        model.setMiningSchema(miningSchema);
        final List<Field<?>> fields = getFieldsFromDataDictionary(dataDictionary);
        Optional<String> retrieved = org.kie.pmml.compiler.api.utils.ModelUtils.getTargetFieldName(fields, model);
        assertThat(retrieved.isPresent()).isFalse();
        usageType = MiningField.UsageType.PREDICTED;
        miningField = getMiningField(fieldName, usageType);
        miningSchema = new MiningSchema();
        miningSchema.addMiningFields(miningField);
        model.setMiningSchema(miningSchema);
        retrieved = org.kie.pmml.compiler.api.utils.ModelUtils.getTargetFieldName(fields, model);
        assertThat(retrieved.isPresent()).isTrue();
        assertThat(retrieved.get()).isEqualTo(fieldName);
    }