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 testDataMapToSpecificRecordTranslatorInnerRecord() throws IOException {
    RecordDataSchema recordDataSchema =
        (RecordDataSchema) TestUtil.dataSchemaFromString(TestEventRecordOfRecord.TEST_SCHEMA.toString());
    RecordDataSchema innerRecordDataSchema =
        (RecordDataSchema) TestUtil.dataSchemaFromString(TestEventWithUnionAndEnum.TEST_SCHEMA.toString());

    Schema avroSchema = TestEventRecordOfRecord.TEST_SCHEMA;
    Schema innerAvroSchema = TestEventWithUnionAndEnum.TEST_SCHEMA;
    DataMap innerMap2 = new DataMap();
    innerMap2.put("fieldName", "field");
    innerMap2.put("eventData", new DataMap(ImmutableMap.of("long", 1L)));
    innerMap2.put("enumData", EnumData.APPROVED.toString());

    TestEventRecordOfRecord testEventRecordOfRecord =
        DataTranslator.dataMapToSpecificRecord(new DataMap(ImmutableMap.of("innerField", innerMap2, "stringArray", new DataList(Arrays.asList("val1")))), recordDataSchema,
            avroSchema);
    TestEventWithUnionAndEnum innerEvent =
        DataTranslator.dataMapToSpecificRecord(innerMap2, innerRecordDataSchema, innerAvroSchema);
    Assert.assertEquals(testEventRecordOfRecord.get(0), innerEvent);
    Assert.assertEquals(testEventRecordOfRecord.get(1), Arrays.asList("[val1]"));
  }