### Question:
IcebergTableName { public static IcebergTableName from(String name) { Matcher match = TABLE_PATTERN.matcher(name); if (!match.matches()) { throw new PrestoException(NOT_SUPPORTED, "Invalid Iceberg table name: " + name); } String table = match.group("table"); String typeString = match.group("type"); String ver1 = match.group("ver1"); String ver2 = match.group("ver2"); TableType type = TableType.DATA; if (typeString != null) { try { type = TableType.valueOf(typeString.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException e) { throw new PrestoException(NOT_SUPPORTED, format("Invalid Iceberg table name (unknown type '%s'): %s", typeString, name)); } } Optional<Long> version = Optional.empty(); if (type == TableType.DATA || type == TableType.PARTITIONS || type == TableType.MANIFESTS || type == TableType.FILES) { if (ver1 != null && ver2 != null) { throw new PrestoException(NOT_SUPPORTED, "Invalid Iceberg table name (cannot specify two @ versions): " + name); } if (ver1 != null) { version = Optional.of(parseLong(ver1)); } else if (ver2 != null) { version = Optional.of(parseLong(ver2)); } } else if (ver1 != null || ver2 != null) { throw new PrestoException(NOT_SUPPORTED, format("Invalid Iceberg table name (cannot use @ version with table type '%s'): %s", type, name)); } return new IcebergTableName(table, type, version); } IcebergTableName(String tableName, TableType tableType, Optional<Long> snapshotId); String getTableName(); TableType getTableType(); Optional<Long> getSnapshotId(); String getTableNameWithType(); @Override String toString(); static IcebergTableName from(String name);  }### Answer:
@Test public void testFrom() { assertFrom("abc", "abc", TableType.DATA, Optional.empty()); assertFrom("abc@123", "abc", TableType.DATA, Optional.of(123L)); assertFrom("abc$data", "abc", TableType.DATA, Optional.empty()); assertFrom("xyz@456", "xyz", TableType.DATA, Optional.of(456L)); assertFrom("xyz$data@456", "xyz", TableType.DATA, Optional.of(456L)); assertFrom("abc$partitions@456", "abc", TableType.PARTITIONS, Optional.of(456L)); assertFrom("abc$manifests@456", "abc", TableType.MANIFESTS, Optional.of(456L)); assertFrom("abc$manifests@456", "abc", TableType.MANIFESTS, Optional.of(456L)); assertFrom("abc$history", "abc", TableType.HISTORY, Optional.empty()); assertFrom("abc$snapshots", "abc", TableType.SNAPSHOTS, Optional.empty()); assertInvalid("abc@xyz", "Invalid Iceberg table name: abc@xyz"); assertInvalid("abc$what", "Invalid Iceberg table name (unknown type 'what'): abc$what"); assertInvalid("abc@123$data@456", "Invalid Iceberg table name (cannot specify two @ versions): abc@123$data@456"); assertInvalid("abc@123$snapshots", "Invalid Iceberg table name (cannot use @ version with table type 'SNAPSHOTS'): abc@123$snapshots"); assertInvalid("abc$snapshots@456", "Invalid Iceberg table name (cannot use @ version with table type 'SNAPSHOTS'): abc$snapshots@456"); }