public static Object fillInDataDefault(DataSchema schema, Object dataWithoutDefault)
  {
    try
    {
      switch (schema.getType())
      {
        case RECORD:
          return fillInDefaultOnRecord((RecordDataSchema) schema, (DataMap) dataWithoutDefault);
        case TYPEREF:
          return fillInDefaultOnTyperef((TyperefDataSchema) schema, dataWithoutDefault);
        case MAP:
          return fillInDefaultOnMap((MapDataSchema) schema, (DataMap) dataWithoutDefault);
        case UNION:
          return fillInDefaultOnUnion((UnionDataSchema) schema, (DataMap) dataWithoutDefault);
        case ARRAY:
          return fillInDefaultOnArray((ArrayDataSchema) schema, (DataList) dataWithoutDefault);
        default:
          return dataWithoutDefault;
      }
    }
    catch (CloneNotSupportedException ex)
    {
      throw new RestLiServiceException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, ex);
    }
  }
@Test(dataProvider = "default_serialization")
  public void testGetAbsentFieldsDefaultValues(String caseFilename)
  {
    try
    {
      MultiFormatDataSchemaResolver schemaResolver = MultiFormatDataSchemaResolver.withBuiltinFormats(resolverDir);
      String expectedDataJsonFile = Files.readFile(new File(pegasusDir + FS + caseFilename));
      DataMap caseData = DataMapUtils.readMap(new ByteArrayInputStream(expectedDataJsonFile.getBytes()), Collections.emptyMap());

      String schemaFileText = Files.readFile(new File(pegasusDir + FS + caseData.get("schema")));
      DataMap caseInput = (DataMap) caseData.get("input");
      DataMap caseExpect = (DataMap) caseData.get("expect");
      DataSchema schema = DataTemplateUtil.parseSchema(schemaFileText, schemaResolver, SchemaFormatType.PDL);
      DataMap dataWithDefault = (DataMap) ResponseUtils.fillInDataDefault(schema, caseInput);
      System.out.println("Expect " + caseExpect);
      System.out.println("Actual " + dataWithDefault);
      Assert.assertEquals(dataWithDefault, caseExpect, (String) caseData.get("context"));
    }
    catch (Exception e)
    {
      Assert.fail("Test failed with exception: \n" + e.toString());
    }
  }