public static ViewMetadata fromJson(String metadataLocation, String json) {
    return JsonUtil.parse(json, node -> ViewMetadataParser.fromJson(metadataLocation, node));
  }
@Test
  public void viewMetadataWithMultipleSQLsForDialectShouldBeReadable() throws Exception {
    ViewVersion viewVersion =
        ImmutableViewVersion.builder()
            .versionId(1)
            .timestampMillis(4353L)
            .summary(ImmutableMap.of("user", "some-user"))
            .schemaId(0)
            .defaultCatalog("some-catalog")
            .defaultNamespace(Namespace.empty())
            .addRepresentations(
                ImmutableSQLViewRepresentation.builder()
                    .sql("select 'foo' foo")
                    .dialect("spark-sql")
                    .build())
            .addRepresentations(
                ImmutableSQLViewRepresentation.builder()
                    .sql("select * from foo")
                    .dialect("spark-sql")
                    .build())
            .build();

    String json =
        readViewMetadataInputFile(
            "org/apache/iceberg/view/ViewMetadataMultipleSQLsForDialect.json");

    // builder will throw an exception due to having multiple SQLs for the same dialect, thus
    // construct the expected view metadata directly
    ViewMetadata expectedViewMetadata =
        ImmutableViewMetadata.of(
            "fa6506c3-7681-40c8-86dc-e36561f83385",
            1,
            "s3://bucket/test/location",
            ImmutableList.of(TEST_SCHEMA),
            1,
            ImmutableList.of(viewVersion),
            ImmutableList.of(
                ImmutableViewHistoryEntry.builder().versionId(1).timestampMillis(4353).build()),
            ImmutableMap.of("some-key", "some-value"),
            ImmutableList.of(),
            null);

    // reading view metadata with multiple SQLs for the same dialects shouldn't fail
    ViewMetadata actual = ViewMetadataParser.fromJson(json);
    assertThat(actual)
        .usingRecursiveComparison()
        .ignoringFieldsOfTypes(Schema.class)
        .isEqualTo(expectedViewMetadata);
  }