public static SnowflakeIdentifier toSnowflakeIdentifier(Namespace namespace) {
    switch (namespace.length()) {
      case NAMESPACE_ROOT_LEVEL:
        return SnowflakeIdentifier.ofRoot();
      case NAMESPACE_DB_LEVEL:
        return SnowflakeIdentifier.ofDatabase(namespace.level(NAMESPACE_DB_LEVEL - 1));
      case NAMESPACE_SCHEMA_LEVEL:
        return SnowflakeIdentifier.ofSchema(
            namespace.level(NAMESPACE_DB_LEVEL - 1), namespace.level(NAMESPACE_SCHEMA_LEVEL - 1));
      default:
        throw new IllegalArgumentException(
            String.format(
                "Snowflake max namespace level is %d, got namespace '%s'",
                MAX_NAMESPACE_DEPTH, namespace));
    }
  }
@Test
  public void testToSnowflakeIdentifierMaxNamespaceLevel() {
    assertThatExceptionOfType(IllegalArgumentException.class)
        .isThrownBy(
            () ->
                NamespaceHelpers.toSnowflakeIdentifier(
                    Namespace.of("DB1", "SCHEMA1", "THIRD_NS_LVL")))
        .withMessageContaining("max namespace level");
  }