public static DataType getDataType(final List<Field<?>> fields,
                                       final String fieldName) {
        return fields.stream()
                .filter(fld -> Objects.equals(fieldName,fld.getName()))
                .map(Field::getDataType)
                .findFirst()
                .orElseThrow(() -> new KiePMMLInternalException(String.format("Failed to find DataType for " +
                                                                                      "field %s",
                                                                              fieldName)));
    }
@Test
    void getDataTypeFromDerivedFieldsAndDataDictionary() {
        final DataDictionary dataDictionary = new DataDictionary();
        IntStream.range(0, 3).forEach(i -> {
            final DataField dataField = getRandomDataField();
            dataDictionary.addDataFields(dataField);
        });
        final List<DerivedField> derivedFields = dataDictionary.getDataFields()
                .stream()
                .map(dataField -> {
                    DerivedField toReturn = new DerivedField();
                    toReturn.setName("DER_" +dataField.getName());
                    DataType dataType = getRandomDataType();
                    while (dataType.equals(dataField.getDataType())) {
                        dataType = getRandomDataType();
                    }
                    toReturn.setDataType(dataType);
                    return toReturn;
                })
                .collect(Collectors.toList());
        final List<Field<?>> fields = new ArrayList<>();
        dataDictionary.getDataFields().stream()
                .map(Field.class::cast)
                .forEach(fields::add);
        derivedFields.stream()
                .map(Field.class::cast)
                .forEach(fields::add);
        dataDictionary.getDataFields().forEach(dataField -> {
            String fieldName =dataField.getName();
            DataType retrieved = org.kie.pmml.compiler.api.utils.ModelUtils.getDataType(fields, fieldName);
            assertThat(retrieved).isNotNull();
            DataType expected = dataField.getDataType();
            assertThat(retrieved).isEqualTo(expected);
        });
        derivedFields.forEach(derivedField -> {
            String fieldName =derivedField.getName();
            DataType retrieved = org.kie.pmml.compiler.api.utils.ModelUtils.getDataType(fields, fieldName);
            assertThat(retrieved).isNotNull();
            DataType expected = derivedField.getDataType();
            assertThat(retrieved).isEqualTo(expected);
        });
    }