@VisibleForTesting
  Schema convertSchema(org.apache.avro.Schema schema) {
    return Schema.of(getFields(schema));
  }
@Test
  void convertSchema_maps() {
    Schema input = SchemaBuilder.record("testRecord")
        .fields()
        .name("intMap")
        .type()
        .map()
        .values()
        .intType().noDefault()
        .name("recordMap")
        .type()
        .nullable()
        .map()
        .values(SchemaBuilder.record("element").fields().requiredDouble("requiredDouble").optionalString("optionalString").endRecord())
        .noDefault()
        .endRecord();


    com.google.cloud.bigquery.Schema expected = com.google.cloud.bigquery.Schema.of(
        Field.newBuilder("intMap", StandardSQLTypeName.STRUCT,
                Field.newBuilder("key_value", StandardSQLTypeName.STRUCT,
                        Field.newBuilder("key", StandardSQLTypeName.STRING).setMode(Field.Mode.REQUIRED).build(),
                        Field.newBuilder("value", StandardSQLTypeName.INT64).setMode(Field.Mode.REQUIRED).build())
                    .setMode(Field.Mode.REPEATED).build())
            .setMode(Field.Mode.NULLABLE).build(),
        Field.newBuilder("recordMap", StandardSQLTypeName.STRUCT,
                Field.newBuilder("key_value", StandardSQLTypeName.STRUCT,
                    Field.newBuilder("key", StandardSQLTypeName.STRING).setMode(Field.Mode.REQUIRED).build(),
                    Field.newBuilder("value", StandardSQLTypeName.STRUCT,
                        Field.newBuilder("requiredDouble", StandardSQLTypeName.FLOAT64).setMode(Field.Mode.REQUIRED).build(),
                        Field.newBuilder("optionalString", StandardSQLTypeName.STRING).setMode(Field.Mode.NULLABLE).build()
                    ).setMode(Field.Mode.REQUIRED).build()).setMode(Field.Mode.REPEATED).build())
            .setMode(Field.Mode.NULLABLE).build());

    Assertions.assertEquals(expected, SCHEMA_RESOLVER.convertSchema(input));
  }