public static GenericRecord dataMapToGenericRecord(DataMap map, RecordDataSchema dataSchema) throws DataTranslationException
  {
    Schema avroSchema = SchemaTranslator.dataToAvroSchema(dataSchema);
    return dataMapToGenericRecord(map, dataSchema, avroSchema, null);
  }
@Test
  public void testInfinityAndNan() throws IOException {
    String schemaText =
        "{\n" +
          "  \"type\" : \"record\",\n" +
          "  \"name\" : \"Foo\",\n" +
          "  \"fields\" : [\n" +
          "    { \"name\" : \"doubleRequired\", \"type\" : \"double\" },\n" +
          "    { \"name\" : \"floatRequired\", \"type\" : \"float\" }\n" +
          "  ]\n" +
          "}\n";
    // First element is the input, second element is the expected output
    Object[][] inputs = {
        {
            "{ \"doubleRequired\" : \"Infinity\", \"floatRequired\" : \"Infinity\"}",
            Double.POSITIVE_INFINITY,
            Float.POSITIVE_INFINITY
        }, {
            "{ \"doubleRequired\" : \"NaN\", \"floatRequired\" : \"NaN\"}",
            Double.NaN,
            Float.NaN
        }, {
            "{ \"doubleRequired\" : \"-Infinity\", \"floatRequired\" : \"-Infinity\"}",
            Double.NEGATIVE_INFINITY,
             Float.NEGATIVE_INFINITY
        }
    };
    RecordDataSchema recordDataSchema = (RecordDataSchema) TestUtil.dataSchemaFromString(schemaText);
    for (Object[] input : inputs) {
      DataMap dataMap = TestUtil.dataMapFromString((String) input[0]);
      Schema avroSchema = SchemaTranslator.dataToAvroSchema(recordDataSchema);
      GenericRecord avroRecord = DataTranslator.dataMapToGenericRecord(dataMap, recordDataSchema, avroSchema);
      assertEquals(avroRecord.get("doubleRequired"), input[1]);
      assertEquals(avroRecord.get("floatRequired"), input[2]);
    }


  }