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(dataProvider = "testDataMapToSpecificRecordTranslatorUnionProvider")
  public void testDataMapToSpecificRecordTranslatorUnion(String field1, String fieldVal1, String field2,
      Object fieldVal2, String field3, EnumData enumData, Object testVal) throws IOException {
    RecordDataSchema recordDataSchema =
        (RecordDataSchema) TestUtil.dataSchemaFromString(TestEventWithUnionAndEnum.TEST_SCHEMA.toString());

    Schema avroSchema = TestEventWithUnionAndEnum.TEST_SCHEMA;
    DataMap innerMap2 = new DataMap();
    innerMap2.put(field1, fieldVal1);
    innerMap2.put(field2, fieldVal2);
    innerMap2.put(field3, enumData.toString());

    TestEventWithUnionAndEnum event = DataTranslator.dataMapToSpecificRecord(innerMap2, recordDataSchema, avroSchema);
    Assert.assertEquals(event.get(event.getSchema().getField(field1).pos()), fieldVal1);
    Assert.assertEquals(event.get(event.getSchema().getField(field2).pos()), testVal);
    Assert.assertEquals(event.get(event.getSchema().getField(field3).pos()), enumData);
  }