public static <T extends SpecificRecordBase> T dataMapToSpecificRecord(DataMap map, RecordDataSchema dataSchema,
      Schema avroSchema) throws DataTranslationException {
    DataMapToSpecificRecordTranslator translator = new DataMapToSpecificRecordTranslator();
    try {
      T avroRecord = translator.translate(map, dataSchema, avroSchema);
      translator.checkMessageListForErrorsAndThrowDataTranslationException();
      return avroRecord;
    } catch (RuntimeException e) {
      throw translator.dataTranslationException(e);
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
      throw translator.dataTranslationException(new RuntimeException(e));
    }
  }
@Test
  public void testArrayOfRecords() throws IOException {
    RecordDataSchema recordDataSchema =
        (RecordDataSchema) TestUtil.dataSchemaFromString(RecordArray.TEST_SCHEMA.toString());

    DataMap stringRecord =
        new DataMap(ImmutableMap.of("stringField", new DataMap(ImmutableMap.of("string", "stringVal"))));
    DataList recordArray = new DataList(Arrays.asList(stringRecord));

    RecordArray recordArrayEvent =
        DataTranslator.dataMapToSpecificRecord(new DataMap(ImmutableMap.of("recordArray", recordArray)),
            recordDataSchema, RecordArray.TEST_SCHEMA);

    StringRecord stringRecordEvent = DataTranslator.dataMapToSpecificRecord(stringRecord,
        (RecordDataSchema) TestUtil.dataSchemaFromString(StringRecord.TEST_SCHEMA.toString()), StringRecord.TEST_SCHEMA);

    Assert.assertEquals(recordArrayEvent.get(0), Arrays.asList(stringRecordEvent));
  }