nastra commented on code in PR #9381: URL: https://github.com/apache/iceberg/pull/9381#discussion_r1438119069
########## flink/v1.18/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogTable.java: ########## @@ -94,84 +89,77 @@ public void testGetTable() { new Schema( Types.NestedField.optional(1, "id", Types.LongType.get()), Types.NestedField.optional(2, "strV", Types.StringType.get())); - Assert.assertEquals( - "Should load the expected iceberg schema", iSchema.toString(), table.schema().toString()); + assertThat(table.schema().toString()) + .as("Should load the expected iceberg schema") + .isEqualTo(iSchema.toString()); } - @Test + @TestTemplate public void testRenameTable() { - Assume.assumeFalse("HadoopCatalog does not support rename table", isHadoopCatalog); - + assumeThat(isHadoopCatalog).as("HadoopCatalog does not support rename table").isFalse(); final Schema tableSchema = new Schema(Types.NestedField.optional(0, "id", Types.LongType.get())); validationCatalog.createTable(TableIdentifier.of(icebergNamespace, "tl"), tableSchema); sql("ALTER TABLE tl RENAME TO tl2"); - Assertions.assertThatThrownBy(() -> getTableEnv().from("tl")) + assertThatThrownBy(() -> getTableEnv().from("tl")) .isInstanceOf(ValidationException.class) .hasMessage("Table `tl` was not found."); Schema actualSchema = FlinkSchemaUtil.convert(getTableEnv().from("tl2").getSchema()); - Assert.assertEquals(tableSchema.asStruct(), actualSchema.asStruct()); + assertThat(tableSchema.asStruct()).isEqualTo(actualSchema.asStruct()); } - @Test + @TestTemplate public void testCreateTable() throws TableNotExistException { sql("CREATE TABLE tl(id BIGINT)"); Table table = table("tl"); - Assert.assertEquals( - new Schema(Types.NestedField.optional(1, "id", Types.LongType.get())).asStruct(), - table.schema().asStruct()); - + assertThat(table.schema().asStruct()) + .isEqualTo( + new Schema(Types.NestedField.optional(1, "id", Types.LongType.get())).asStruct()); CatalogTable catalogTable = catalogTable("tl"); - Assert.assertEquals( - TableSchema.builder().field("id", DataTypes.BIGINT()).build(), catalogTable.getSchema()); + assertThat(catalogTable.getSchema()) + .isEqualTo(TableSchema.builder().field("id", DataTypes.BIGINT()).build()); } - @Test + @TestTemplate public void testCreateTableWithPrimaryKey() throws Exception { sql("CREATE TABLE tl(id BIGINT, data STRING, key STRING PRIMARY KEY NOT ENFORCED)"); Table table = table("tl"); - Assert.assertEquals( - "Should have the expected row key.", - Sets.newHashSet(table.schema().findField("key").fieldId()), - table.schema().identifierFieldIds()); - + assertThat(table.schema().identifierFieldIds()) + .as("Should have the expected row key.") + .isEqualTo(Sets.newHashSet(table.schema().findField("key").fieldId())); CatalogTable catalogTable = catalogTable("tl"); Optional<UniqueConstraint> uniqueConstraintOptional = catalogTable.getSchema().getPrimaryKey(); - Assert.assertTrue( - "Should have the expected unique constraint", uniqueConstraintOptional.isPresent()); - Assert.assertEquals( - "Should have the expected columns", - ImmutableList.of("key"), - uniqueConstraintOptional.get().getColumns()); + assertThat(uniqueConstraintOptional.isPresent()).isTrue(); + assertThat(uniqueConstraintOptional.get().getColumns()) Review Comment: ```suggestion assertThat(uniqueConstraintOptional.get().getColumns()).containsExactly("key"); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org