private UnifiedCatalog createNewCatalogTable(String catalogName, String dbName, String tableName)
      throws IOException, TException {
    // create new catalog
    String warehouseDir = temp.newFolder().getPath();
    Map<String, String> properties = Maps.newHashMap();
    properties.put(CatalogMetaProperties.KEY_WAREHOUSE, warehouseDir);
    CatalogMeta catalogMeta =
        CatalogTestHelpers.buildCatalogMeta(
            catalogName,
            CatalogMetaProperties.CATALOG_TYPE_HADOOP,
            properties,
            TableFormat.ICEBERG);
    UnifiedCatalog externalCatalog = new CommonUnifiedCatalog(() -> catalogMeta, Maps.newHashMap());
    catalogManager().createCatalog(catalogMeta);

    // create new database
    try {
      Database database = new Database();
      database.setName(dbName);
      TEST_HMS.getHiveClient().createDatabase(database);
    } catch (AlreadyExistsException e) {
      // pass
    }
    List<String> databases = externalCatalog.listDatabases();
    if (!(databases != null && databases.contains(dbName))) {
      externalCatalog.createDatabase(dbName);
    }
    // create new table
    Map<String, String> catalogProperties = Maps.newHashMap(catalogMeta.getCatalogProperties());
    catalogProperties.put(
        CatalogUtil.ICEBERG_CATALOG_TYPE, CatalogUtil.ICEBERG_CATALOG_TYPE_HADOOP);
    org.apache.iceberg.catalog.Catalog catalog =
        CatalogUtil.buildIcebergCatalog(catalogName, catalogProperties, new Configuration());
    catalog.createTable(
        org.apache.iceberg.catalog.TableIdentifier.of(dbName, tableName),
        tableTestHelper().tableSchema(),
        tableTestHelper().partitionSpec(),
        tableTestHelper().tableProperties());

    return externalCatalog;
  }
Test synchronization in the anomaly scenario where the tableIdentifier is remained in
persistence and the tableRuntime is remained in memory but iceberg table does not exist.
amoro-ams/src/test/java/org/apache/amoro/server/table/TestSyncTableOfExternalCatalog.java