public static ViewMetadata fromJson(String metadataLocation, String json) {
    return JsonUtil.parse(json, node -> ViewMetadataParser.fromJson(metadataLocation, node));
  }
@Test
  public void replaceViewMetadataWithMultipleSQLsForDialect() throws Exception {
    String json =
        readViewMetadataInputFile(
            "org/apache/iceberg/view/ViewMetadataMultipleSQLsForDialect.json");

    // reading view metadata with multiple SQLs for the same dialects shouldn't fail
    ViewMetadata invalid = ViewMetadataParser.fromJson(json);

    // replace metadata with a new view version that fixes the SQL representations
    ViewVersion viewVersion =
        ImmutableViewVersion.builder()
            .versionId(2)
            .schemaId(0)
            .timestampMillis(5555L)
            .summary(ImmutableMap.of("user", "some-user"))
            .defaultCatalog("some-catalog")
            .defaultNamespace(Namespace.empty())
            .addRepresentations(
                ImmutableSQLViewRepresentation.builder()
                    .sql("select * from foo")
                    .dialect("spark-sql")
                    .build())
            .build();

    ViewMetadata replaced =
        ViewMetadata.buildFrom(invalid).addVersion(viewVersion).setCurrentVersionId(2).build();

    assertThat(replaced.currentVersion()).isEqualTo(viewVersion);
  }