tomtongue commented on code in PR #10086:
URL: https://github.com/apache/iceberg/pull/10086#discussion_r1555328887


##########
aws/src/integration/java/org/apache/iceberg/aws/dynamodb/TestDynamoDbCatalog.java:
##########
@@ -99,22 +100,23 @@ public void testCreateNamespace() {
                 .tableName(catalogTableName)
                 .key(DynamoDbCatalog.namespacePrimaryKey(namespace))
                 .build());
-    Assert.assertTrue("namespace must exist", response.hasItem());
-    Assert.assertEquals(
-        "namespace must be stored in DynamoDB",
-        namespace.toString(),
-        response.item().get("namespace").s());
-    Assertions.assertThatThrownBy(() -> catalog.createNamespace(namespace))
+    assertThat(response.hasItem()).as("namespace must exist").isTrue();
+    assertThat(response.item())
+        .as("namespace must be stored in DynamoDB")
+        .hasEntrySatisfying(
+            "namespace",
+            attributeValue -> 
assertThat(attributeValue.s()).isEqualTo(namespace.toString()));

Review Comment:
   Thanks for the suggestion. I think your suggestion seems to be fine, but my 
change also checks if `response.item` has `namespace` or not.  But if the value 
extraction by`get("namespace")`, it doesn't check in the test. So if this part 
is like your suggestion, it's better to write like:
   
   ```
   assertThat(response.item()).containsKey("namespace")
   assertThat(response.item().get("namespace").s())...
   ```
   
   That's why I'm using `hasEntrySatisfying` here. If I'm wrong here, please 
correct me.



-- 
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

Reply via email to