coded9 commented on code in PR #8948:
URL: https://github.com/apache/iceberg/pull/8948#discussion_r1377022140


##########
spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestUpdate.java:
##########
@@ -1383,36 +1380,35 @@ public void testUpdateWithInvalidAssignmentsAnsi() {
     withSQLConf(
         ImmutableMap.of("spark.sql.storeAssignmentPolicy", "ansi"),
         () -> {
-          AssertHelpers.assertThrows(
-              "Should complain about writing nulls to a top-level column",
-              SparkException.class,
-              "Null value appeared in non-nullable field",
-              () -> sql("UPDATE %s t SET t.id = NULL", commitTarget()));
-
-          AssertHelpers.assertThrows(
-              "Should complain about writing nulls to a nested column",
-              SparkException.class,
-              "Null value appeared in non-nullable field",
-              () -> sql("UPDATE %s t SET t.s.n1 = NULL", commitTarget()));
-
-          AssertHelpers.assertThrows(
-              "Should complain about writing missing fields in structs",
-              AnalysisException.class,
-              "Cannot find data for the output column `s`.`n2`",
-              () -> sql("UPDATE %s t SET t.s = named_struct('n1', 1)", 
commitTarget()));
-
-          AssertHelpers.assertThrows(
-              "Should complain about writing invalid data types",
-              AnalysisException.class,
-              "Cannot safely cast",
-              () -> sql("UPDATE %s t SET t.s.n1 = 'str'", commitTarget()));
-
-          AssertHelpers.assertThrows(
-              "Should complain about writing incompatible structs",
-              AnalysisException.class,
-              "Cannot find data for the output column `s`.`n2`.`dn2`",
-              () ->
-                  sql("UPDATE %s t SET t.s.n2 = named_struct('dn3', 1, 'dn1', 
2)", commitTarget()));
+          Assertions.assertThatThrownBy(() -> sql("UPDATE %s t SET t.id = 
NULL", commitTarget()))
+              .as("Should complain about writing nulls to a top-level column")
+              .isInstanceOf(SparkException.class)
+              .hasMessageContaining("Null value appeared in non-nullable 
field");
+
+          Assertions.assertThatThrownBy(() -> sql("UPDATE %s t SET t.s.n1 = 
NULL", commitTarget()))
+              .as("Should complain about writing nulls to a nested column")
+              .isInstanceOf(SparkException.class)
+              .hasMessageContaining("Null value appeared in non-nullable 
field");
+
+          Assertions.assertThatThrownBy(
+                  () -> sql("UPDATE %s t SET t.s = named_struct('n1', 1)", 
commitTarget()))
+              .as("Should complain about writing missing fields in structs")
+              .isInstanceOf(AnalysisException.class)
+              .hasMessageContaining("Cannot find data for the output column 
`s`.`n2`");
+
+          Assertions.assertThatThrownBy(() -> sql("UPDATE %s t SET t.s.n1 = 
'str'", commitTarget()))
+              .as("Should complain about writing invalid data types")
+              .isInstanceOf(AnalysisException.class)
+              .hasMessageContaining("Cannot safely cast");
+
+          Assertions.assertThatThrownBy(
+                  () ->
+                      sql(
+                          "UPDATE %s t SET t.s.n2 = named_struct('dn3', 1, 
'dn1', 2)",
+                          commitTarget()))
+              .as("Should complain about writing incompatible structs")

Review Comment:
   I'm thinking these messages would remind on what all cases to verify for 
this particular class



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to