public static Optional<OP_TYPE> getOpTypeFromFields(final List<Field<?>> fields,
                                                        final String fieldName) {
        return fields == null ? Optional.empty() :
                fields.stream()
                        .filter(dataField -> Objects.equals(fieldName,dataField.getName()) && dataField.getOpType() != null)
                        .map(dataField -> OP_TYPE.byName(dataField.getOpType().value()))
                        .findFirst();
    }
@Test
    void getOpTypeFromFields() {
        Optional<OP_TYPE> opType = org.kie.pmml.compiler.api.utils.ModelUtils.getOpTypeFromFields(null, "vsd");
        assertThat(opType).isNotNull();
        assertThat(opType.isPresent()).isFalse();
        final DataDictionary dataDictionary = new DataDictionary();
        final List<Field<?>> fields = getFieldsFromDataDictionary(dataDictionary);
        opType = org.kie.pmml.compiler.api.utils.ModelUtils.getOpTypeFromFields(fields, "vsd");
        assertThat(opType).isNotNull();
        assertThat(opType.isPresent()).isFalse();
        IntStream.range(0, 3).forEach(i -> {
            final DataField dataField = getRandomDataField();
            dataDictionary.addDataFields(dataField);
        });
        fields.clear();
        fields.addAll(getFieldsFromDataDictionary(dataDictionary));
        dataDictionary.getDataFields().forEach(dataField -> {
            Optional<OP_TYPE> retrieved = org.kie.pmml.compiler.api.utils.ModelUtils.getOpTypeFromFields(fields,dataField.getName());
            assertThat(retrieved).isNotNull();
            assertThat(retrieved).isPresent();
            OP_TYPE expected = OP_TYPE.byName(dataField.getOpType().value());
            assertThat(retrieved.get()).isEqualTo(expected);
        });
    }