This is an automated email from the ASF dual-hosted git repository.

etudenhoefner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new 31e8c17971 Spark 3.4: Remove deprecated AssertHelpers usage (#8009)
31e8c17971 is described below

commit 31e8c17971ad1dbd49b943aa908f1557a29cc1e3
Author: Liu Xiao <[email protected]>
AuthorDate: Fri Jul 7 20:41:19 2023 +0800

    Spark 3.4: Remove deprecated AssertHelpers usage (#8009)
---
 .../extensions/TestExpireSnapshotsProcedure.java   | 133 ++++++-------
 .../extensions/TestMigrateTableProcedure.java      |  46 ++---
 .../extensions/TestPublishChangesProcedure.java    |  53 +++---
 .../extensions/TestRewriteDataFilesProcedure.java  | 207 ++++++++++-----------
 .../TestRollbackToSnapshotProcedure.java           |  91 ++++-----
 .../TestRollbackToTimestampProcedure.java          |  90 +++++----
 .../TestSetCurrentSnapshotProcedure.java           | 106 +++++------
 .../extensions/TestSnapshotTableProcedure.java     |  59 +++---
 8 files changed, 357 insertions(+), 428 deletions(-)

diff --git 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestExpireSnapshotsProcedure.java
 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestExpireSnapshotsProcedure.java
index efb3d43668..c4b93c6d6a 100644
--- 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestExpireSnapshotsProcedure.java
+++ 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestExpireSnapshotsProcedure.java
@@ -33,7 +33,6 @@ import java.util.stream.Collectors;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.iceberg.AssertHelpers;
 import org.apache.iceberg.GenericBlobMetadata;
 import org.apache.iceberg.GenericStatisticsFile;
 import org.apache.iceberg.Snapshot;
@@ -164,44 +163,36 @@ public class TestExpireSnapshotsProcedure extends 
SparkExtensionsTestBase {
 
     sql("ALTER TABLE %s SET TBLPROPERTIES ('%s' 'false')", tableName, 
GC_ENABLED);
 
-    AssertHelpers.assertThrows(
-        "Should reject call",
-        ValidationException.class,
-        "Cannot expire snapshots: GC is disabled",
-        () -> sql("CALL %s.system.expire_snapshots('%s')", catalogName, 
tableIdent));
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.expire_snapshots('%s')", catalogName, 
tableIdent))
+        .isInstanceOf(ValidationException.class)
+        .hasMessageStartingWith("Cannot expire snapshots: GC is disabled");
   }
 
   @Test
   public void testInvalidExpireSnapshotsCases() {
-    AssertHelpers.assertThrows(
-        "Should not allow mixed args",
-        AnalysisException.class,
-        "Named and positional arguments cannot be mixed",
-        () -> sql("CALL %s.system.expire_snapshots('n', table => 't')", 
catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should not resolve procedures in arbitrary namespaces",
-        NoSuchProcedureException.class,
-        "not found",
-        () -> sql("CALL %s.custom.expire_snapshots('n', 't')", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.expire_snapshots()", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with invalid arg types",
-        AnalysisException.class,
-        "Wrong arg type",
-        () -> sql("CALL %s.system.expire_snapshots('n', 2.2)", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with empty table identifier",
-        IllegalArgumentException.class,
-        "Cannot handle an empty identifier",
-        () -> sql("CALL %s.system.expire_snapshots('')", catalogName));
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.expire_snapshots('n', table => 't')", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Named and positional arguments cannot be mixed");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.custom.expire_snapshots('n', 't')", 
catalogName))
+        .isInstanceOf(NoSuchProcedureException.class)
+        .hasMessage("Procedure custom.expire_snapshots not found");
+
+    Assertions.assertThatThrownBy(() -> sql("CALL 
%s.system.expire_snapshots()", catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [table]");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.expire_snapshots('n', 2.2)", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Wrong arg type for older_than: cannot cast 
DecimalType(2,1) to TimestampType");
+
+    Assertions.assertThatThrownBy(() -> sql("CALL 
%s.system.expire_snapshots('')", catalogName))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot handle an empty identifier for argument table");
   }
 
   @Test
@@ -219,14 +210,13 @@ public class TestExpireSnapshotsProcedure extends 
SparkExtensionsTestBase {
         "CREATE TABLE %s.%s (id bigint NOT NULL, data string) USING iceberg",
         anotherCatalog, tableIdent);
 
-    AssertHelpers.assertThrows(
-        "Should reject calls for a table in another catalog",
-        IllegalArgumentException.class,
-        "Cannot run procedure in catalog",
-        () ->
-            sql(
-                "CALL %s.system.expire_snapshots('%s')",
-                catalogName, anotherCatalog + "." + tableName));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.expire_snapshots('%s')",
+                    catalogName, anotherCatalog + "." + tableName))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessageStartingWith("Cannot run procedure in catalog");
   }
 
   @Test
@@ -256,23 +246,21 @@ public class TestExpireSnapshotsProcedure extends 
SparkExtensionsTestBase {
   public void testConcurrentExpireSnapshotsWithInvalidInput() {
     sql("CREATE TABLE %s (id bigint NOT NULL, data string) USING iceberg", 
tableName);
 
-    AssertHelpers.assertThrows(
-        "Should throw an error when max_concurrent_deletes = 0",
-        IllegalArgumentException.class,
-        "max_concurrent_deletes should have value > 0",
-        () ->
-            sql(
-                "CALL %s.system.expire_snapshots(table => '%s', 
max_concurrent_deletes => %s)",
-                catalogName, tableIdent, 0));
-
-    AssertHelpers.assertThrows(
-        "Should throw an error when max_concurrent_deletes < 0 ",
-        IllegalArgumentException.class,
-        "max_concurrent_deletes should have value > 0",
-        () ->
-            sql(
-                "CALL %s.system.expire_snapshots(table => '%s', 
max_concurrent_deletes => %s)",
-                catalogName, tableIdent, -1));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.expire_snapshots(table => '%s', 
max_concurrent_deletes => %s)",
+                    catalogName, tableIdent, 0))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("max_concurrent_deletes should have value > 0, value: 0");
+
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.expire_snapshots(table => '%s', 
max_concurrent_deletes => %s)",
+                    catalogName, tableIdent, -1))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("max_concurrent_deletes should have value > 0, value: -1");
   }
 
   @Test
@@ -405,19 +393,18 @@ public class TestExpireSnapshotsProcedure extends 
SparkExtensionsTestBase {
     Table table = validationCatalog.loadTable(tableIdent);
     Assert.assertEquals("Should be 2 snapshots", 2, 
Iterables.size(table.snapshots()));
 
-    AssertHelpers.assertThrows(
-        "Should reject call",
-        IllegalArgumentException.class,
-        "Cannot expire",
-        () ->
-            sql(
-                "CALL %s.system.expire_snapshots("
-                    + "table => '%s',"
-                    + "snapshot_ids => ARRAY(%d, %d))",
-                catalogName,
-                tableIdent,
-                table.currentSnapshot().snapshotId(),
-                table.currentSnapshot().parentId()));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.expire_snapshots("
+                        + "table => '%s',"
+                        + "snapshot_ids => ARRAY(%d, %d))",
+                    catalogName,
+                    tableIdent,
+                    table.currentSnapshot().snapshotId(),
+                    table.currentSnapshot().parentId()))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessageStartingWith("Cannot expire");
   }
 
   @Test
diff --git 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestMigrateTableProcedure.java
 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestMigrateTableProcedure.java
index 49fee09408..52ba372958 100644
--- 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestMigrateTableProcedure.java
+++ 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestMigrateTableProcedure.java
@@ -20,11 +20,11 @@ package org.apache.iceberg.spark.extensions;
 
 import java.io.IOException;
 import java.util.Map;
-import org.apache.iceberg.AssertHelpers;
 import org.apache.iceberg.Table;
 import org.apache.iceberg.exceptions.ValidationException;
 import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
 import org.apache.spark.sql.AnalysisException;
+import org.assertj.core.api.Assertions;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Assume;
@@ -131,14 +131,13 @@ public class TestMigrateTableProcedure extends 
SparkExtensionsTestBase {
         "CREATE TABLE %s (id bigint NOT NULL, data string) USING parquet 
LOCATION '%s'",
         tableName, location);
 
-    AssertHelpers.assertThrows(
-        "Should reject invalid metrics config",
-        ValidationException.class,
-        "Invalid metrics config",
-        () -> {
-          String props = "map('write.metadata.metrics.column.x', 'X')";
-          sql("CALL %s.system.migrate('%s', %s)", catalogName, tableName, 
props);
-        });
+    Assertions.assertThatThrownBy(
+            () -> {
+              String props = "map('write.metadata.metrics.column.x', 'X')";
+              sql("CALL %s.system.migrate('%s', %s)", catalogName, tableName, 
props);
+            })
+        .isInstanceOf(ValidationException.class)
+        .hasMessageStartingWith("Invalid metrics config");
   }
 
   @Test
@@ -166,23 +165,18 @@ public class TestMigrateTableProcedure extends 
SparkExtensionsTestBase {
 
   @Test
   public void testInvalidMigrateCases() {
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.migrate()", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with invalid arg types",
-        AnalysisException.class,
-        "Wrong arg type",
-        () -> sql("CALL %s.system.migrate(map('foo','bar'))", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with empty table identifier",
-        IllegalArgumentException.class,
-        "Cannot handle an empty identifier",
-        () -> sql("CALL %s.system.migrate('')", catalogName));
+    Assertions.assertThatThrownBy(() -> sql("CALL %s.system.migrate()", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [table]");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.migrate(map('foo','bar'))", catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessageStartingWith("Wrong arg type for table");
+
+    Assertions.assertThatThrownBy(() -> sql("CALL %s.system.migrate('')", 
catalogName))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot handle an empty identifier for argument table");
   }
 
   @Test
diff --git 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestPublishChangesProcedure.java
 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestPublishChangesProcedure.java
index 2b74cd475f..94c4af3ad5 100644
--- 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestPublishChangesProcedure.java
+++ 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestPublishChangesProcedure.java
@@ -22,7 +22,6 @@ import static 
org.apache.iceberg.TableProperties.WRITE_AUDIT_PUBLISH_ENABLED;
 
 import java.util.List;
 import java.util.Map;
-import org.apache.iceberg.AssertHelpers;
 import org.apache.iceberg.Snapshot;
 import org.apache.iceberg.Table;
 import org.apache.iceberg.exceptions.ValidationException;
@@ -32,6 +31,7 @@ import org.apache.spark.sql.AnalysisException;
 import org.apache.spark.sql.Dataset;
 import org.apache.spark.sql.Row;
 import org.apache.spark.sql.catalyst.analysis.NoSuchProcedureException;
+import org.assertj.core.api.Assertions;
 import org.junit.After;
 import org.junit.Test;
 
@@ -157,37 +157,32 @@ public class TestPublishChangesProcedure extends 
SparkExtensionsTestBase {
   public void testApplyInvalidWapId() {
     sql("CREATE TABLE %s (id bigint NOT NULL, data string) USING iceberg", 
tableName);
 
-    AssertHelpers.assertThrows(
-        "Should reject invalid wap id",
-        ValidationException.class,
-        "Cannot apply unknown WAP ID",
-        () -> sql("CALL %s.system.publish_changes('%s', 'not_valid')", 
catalogName, tableIdent));
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.publish_changes('%s', 'not_valid')", 
catalogName, tableIdent))
+        .isInstanceOf(ValidationException.class)
+        .hasMessage("Cannot apply unknown WAP ID 'not_valid'");
   }
 
   @Test
   public void testInvalidApplyWapChangesCases() {
-    AssertHelpers.assertThrows(
-        "Should not allow mixed args",
-        AnalysisException.class,
-        "Named and positional arguments cannot be mixed",
-        () -> sql("CALL %s.system.publish_changes('n', table => 't', 
'not_valid')", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should not resolve procedures in arbitrary namespaces",
-        NoSuchProcedureException.class,
-        "not found",
-        () -> sql("CALL %s.custom.publish_changes('n', 't', 'not_valid')", 
catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.publish_changes('t')", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with empty table identifier",
-        IllegalArgumentException.class,
-        "Cannot handle an empty identifier",
-        () -> sql("CALL %s.system.publish_changes('', 'not_valid')", 
catalogName));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql("CALL %s.system.publish_changes('n', table => 't', 
'not_valid')", catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Named and positional arguments cannot be mixed");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.custom.publish_changes('n', 't', 'not_valid')", 
catalogName))
+        .isInstanceOf(NoSuchProcedureException.class)
+        .hasMessage("Procedure custom.publish_changes not found");
+
+    Assertions.assertThatThrownBy(() -> sql("CALL 
%s.system.publish_changes('t')", catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [wap_id]");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.publish_changes('', 'not_valid')", 
catalogName))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot handle an empty identifier for argument table");
   }
 }
diff --git 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteDataFilesProcedure.java
 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteDataFilesProcedure.java
index 88fdf29207..8013967181 100644
--- 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteDataFilesProcedure.java
+++ 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteDataFilesProcedure.java
@@ -24,7 +24,6 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.IntStream;
-import org.apache.iceberg.AssertHelpers;
 import org.apache.iceberg.SnapshotSummary;
 import org.apache.iceberg.TableProperties;
 import org.apache.iceberg.catalog.TableIdentifier;
@@ -42,6 +41,7 @@ import org.apache.spark.sql.Dataset;
 import org.apache.spark.sql.Row;
 import org.apache.spark.sql.catalyst.analysis.NoSuchProcedureException;
 import org.apache.spark.sql.internal.SQLConf;
+import org.assertj.core.api.Assertions;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Assume;
@@ -498,136 +498,121 @@ public class TestRewriteDataFilesProcedure extends 
SparkExtensionsTestBase {
     insertData(2);
 
     // Test for invalid strategy
-    AssertHelpers.assertThrows(
-        "Should reject calls with unsupported strategy error message",
-        IllegalArgumentException.class,
-        "unsupported strategy: temp. Only binpack or sort is supported",
-        () ->
-            sql(
-                "CALL %s.system.rewrite_data_files(table => '%s', options => 
map('min-input-files','2'), "
-                    + "strategy => 'temp')",
-                catalogName, tableIdent));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rewrite_data_files(table => '%s', options 
=> map('min-input-files','2'), "
+                        + "strategy => 'temp')",
+                    catalogName, tableIdent))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("unsupported strategy: temp. Only binpack or sort is 
supported");
 
     // Test for sort_order with binpack strategy
-    AssertHelpers.assertThrows(
-        "Should reject calls with error message",
-        IllegalArgumentException.class,
-        "Must use only one rewriter type (bin-pack, sort, zorder)",
-        () ->
-            sql(
-                "CALL %s.system.rewrite_data_files(table => '%s', strategy => 
'binpack', "
-                    + "sort_order => 'c1 ASC NULLS FIRST')",
-                catalogName, tableIdent));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rewrite_data_files(table => '%s', strategy 
=> 'binpack', "
+                        + "sort_order => 'c1 ASC NULLS FIRST')",
+                    catalogName, tableIdent))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Must use only one rewriter type (bin-pack, sort, 
zorder)");
 
     // Test for sort strategy without any (default/user defined) sort_order
-    AssertHelpers.assertThrows(
-        "Should reject calls with error message",
-        IllegalArgumentException.class,
-        "Cannot sort data without a valid sort order",
-        () ->
-            sql(
-                "CALL %s.system.rewrite_data_files(table => '%s', strategy => 
'sort')",
-                catalogName, tableIdent));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rewrite_data_files(table => '%s', strategy 
=> 'sort')",
+                    catalogName, tableIdent))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessageStartingWith("Cannot sort data without a valid sort order");
 
     // Test for sort_order with invalid null order
-    AssertHelpers.assertThrows(
-        "Should reject calls with error message",
-        IllegalArgumentException.class,
-        "Unable to parse sortOrder:",
-        () ->
-            sql(
-                "CALL %s.system.rewrite_data_files(table => '%s', strategy => 
'sort', "
-                    + "sort_order => 'c1 ASC none')",
-                catalogName, tableIdent));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rewrite_data_files(table => '%s', strategy 
=> 'sort', "
+                        + "sort_order => 'c1 ASC none')",
+                    catalogName, tableIdent))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Unable to parse sortOrder: c1 ASC none");
 
     // Test for sort_order with invalid sort direction
-    AssertHelpers.assertThrows(
-        "Should reject calls with error message",
-        IllegalArgumentException.class,
-        "Unable to parse sortOrder:",
-        () ->
-            sql(
-                "CALL %s.system.rewrite_data_files(table => '%s', strategy => 
'sort', "
-                    + "sort_order => 'c1 none NULLS FIRST')",
-                catalogName, tableIdent));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rewrite_data_files(table => '%s', strategy 
=> 'sort', "
+                        + "sort_order => 'c1 none NULLS FIRST')",
+                    catalogName, tableIdent))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Unable to parse sortOrder: c1 none NULLS FIRST");
 
     // Test for sort_order with invalid column name
-    AssertHelpers.assertThrows(
-        "Should reject calls with error message",
-        ValidationException.class,
-        "Cannot find field 'col1' in struct:"
-            + " struct<1: c1: optional int, 2: c2: optional string, 3: c3: 
optional string>",
-        () ->
-            sql(
-                "CALL %s.system.rewrite_data_files(table => '%s', strategy => 
'sort', "
-                    + "sort_order => 'col1 DESC NULLS FIRST')",
-                catalogName, tableIdent));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rewrite_data_files(table => '%s', strategy 
=> 'sort', "
+                        + "sort_order => 'col1 DESC NULLS FIRST')",
+                    catalogName, tableIdent))
+        .isInstanceOf(ValidationException.class)
+        .hasMessageStartingWith("Cannot find field 'col1' in struct:");
 
     // Test with invalid filter column col1
-    AssertHelpers.assertThrows(
-        "Should reject calls with error message",
-        IllegalArgumentException.class,
-        "Cannot parse predicates in where option: col1 = 3",
-        () ->
-            sql(
-                "CALL %s.system.rewrite_data_files(table => '%s', " + "where 
=> 'col1 = 3')",
-                catalogName, tableIdent));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rewrite_data_files(table => '%s', " + 
"where => 'col1 = 3')",
+                    catalogName, tableIdent))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot parse predicates in where option: col1 = 3");
 
     // Test for z_order with invalid column name
-    AssertHelpers.assertThrows(
-        "Should reject calls with error message",
-        IllegalArgumentException.class,
-        "Cannot find column 'col1' in table schema (case sensitive = false): "
-            + "struct<1: c1: optional int, 2: c2: optional string, 3: c3: 
optional string>",
-        () ->
-            sql(
-                "CALL %s.system.rewrite_data_files(table => '%s', strategy => 
'sort', "
-                    + "sort_order => 'zorder(col1)')",
-                catalogName, tableIdent));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rewrite_data_files(table => '%s', strategy 
=> 'sort', "
+                        + "sort_order => 'zorder(col1)')",
+                    catalogName, tableIdent))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage(
+            "Cannot find column 'col1' in table schema (case sensitive = 
false): "
+                + "struct<1: c1: optional int, 2: c2: optional string, 3: c3: 
optional string>");
 
     // Test for z_order with sort_order
-    AssertHelpers.assertThrows(
-        "Should reject calls with error message",
-        IllegalArgumentException.class,
-        "Cannot mix identity sort columns and a Zorder sort expression:" + " 
c1,zorder(c2,c3)",
-        () ->
-            sql(
-                "CALL %s.system.rewrite_data_files(table => '%s', strategy => 
'sort', "
-                    + "sort_order => 'c1,zorder(c2,c3)')",
-                catalogName, tableIdent));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rewrite_data_files(table => '%s', strategy 
=> 'sort', "
+                        + "sort_order => 'c1,zorder(c2,c3)')",
+                    catalogName, tableIdent))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage(
+            "Cannot mix identity sort columns and a Zorder sort expression:" + 
" c1,zorder(c2,c3)");
   }
 
   @Test
   public void testInvalidCasesForRewriteDataFiles() {
-    AssertHelpers.assertThrows(
-        "Should not allow mixed args",
-        AnalysisException.class,
-        "Named and positional arguments cannot be mixed",
-        () -> sql("CALL %s.system.rewrite_data_files('n', table => 't')", 
catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should not resolve procedures in arbitrary namespaces",
-        NoSuchProcedureException.class,
-        "not found",
-        () -> sql("CALL %s.custom.rewrite_data_files('n', 't')", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.rewrite_data_files()", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject duplicate arg names name",
-        AnalysisException.class,
-        "Duplicate procedure argument: table",
-        () -> sql("CALL %s.system.rewrite_data_files(table => 't', table => 
't')", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with empty table identifier",
-        IllegalArgumentException.class,
-        "Cannot handle an empty identifier",
-        () -> sql("CALL %s.system.rewrite_data_files('')", catalogName));
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.rewrite_data_files('n', table => 't')", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Named and positional arguments cannot be mixed");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.custom.rewrite_data_files('n', 't')", 
catalogName))
+        .isInstanceOf(NoSuchProcedureException.class)
+        .hasMessage("Procedure custom.rewrite_data_files not found");
+
+    Assertions.assertThatThrownBy(() -> sql("CALL 
%s.system.rewrite_data_files()", catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [table]");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.rewrite_data_files(table => 't', table 
=> 't')", catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessageEndingWith("Duplicate procedure argument: table");
+
+    Assertions.assertThatThrownBy(() -> sql("CALL 
%s.system.rewrite_data_files('')", catalogName))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot handle an empty identifier for argument table");
   }
 
   @Test
diff --git 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRollbackToSnapshotProcedure.java
 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRollbackToSnapshotProcedure.java
index af94b456d0..1b4cd2b4a3 100644
--- 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRollbackToSnapshotProcedure.java
+++ 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRollbackToSnapshotProcedure.java
@@ -20,7 +20,6 @@ package org.apache.iceberg.spark.extensions;
 
 import java.util.List;
 import java.util.Map;
-import org.apache.iceberg.AssertHelpers;
 import org.apache.iceberg.Snapshot;
 import org.apache.iceberg.Table;
 import org.apache.iceberg.exceptions.ValidationException;
@@ -29,6 +28,7 @@ import org.apache.spark.sql.AnalysisException;
 import org.apache.spark.sql.Dataset;
 import org.apache.spark.sql.Row;
 import org.apache.spark.sql.catalyst.analysis.NoSuchProcedureException;
+import org.assertj.core.api.Assertions;
 import org.junit.After;
 import org.junit.Assume;
 import org.junit.Test;
@@ -240,58 +240,49 @@ public class TestRollbackToSnapshotProcedure extends 
SparkExtensionsTestBase {
   public void testRollbackToInvalidSnapshot() {
     sql("CREATE TABLE %s (id bigint NOT NULL, data string) USING iceberg", 
tableName);
 
-    AssertHelpers.assertThrows(
-        "Should reject invalid snapshot id",
-        ValidationException.class,
-        "Cannot roll back to unknown snapshot id",
-        () -> sql("CALL %s.system.rollback_to_snapshot('%s', -1L)", 
catalogName, tableIdent));
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.rollback_to_snapshot('%s', -1L)", 
catalogName, tableIdent))
+        .isInstanceOf(ValidationException.class)
+        .hasMessage("Cannot roll back to unknown snapshot id: -1");
   }
 
   @Test
   public void testInvalidRollbackToSnapshotCases() {
-    AssertHelpers.assertThrows(
-        "Should not allow mixed args",
-        AnalysisException.class,
-        "Named and positional arguments cannot be mixed",
-        () ->
-            sql(
-                "CALL %s.system.rollback_to_snapshot(namespace => 'n1', table 
=> 't', 1L)",
-                catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should not resolve procedures in arbitrary namespaces",
-        NoSuchProcedureException.class,
-        "not found",
-        () -> sql("CALL %s.custom.rollback_to_snapshot('n', 't', 1L)", 
catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.rollback_to_snapshot('t')", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.rollback_to_snapshot(1L)", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.rollback_to_snapshot(table => 't')", 
catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with invalid arg types",
-        AnalysisException.class,
-        "Wrong arg type for snapshot_id: cannot cast",
-        () -> sql("CALL %s.system.rollback_to_snapshot('t', 2.2)", 
catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with empty table identifier",
-        IllegalArgumentException.class,
-        "Cannot handle an empty identifier",
-        () -> sql("CALL %s.system.rollback_to_snapshot('', 1L)", catalogName));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rollback_to_snapshot(namespace => 'n1', 
table => 't', 1L)",
+                    catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Named and positional arguments cannot be mixed");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.custom.rollback_to_snapshot('n', 't', 1L)", 
catalogName))
+        .isInstanceOf(NoSuchProcedureException.class)
+        .hasMessage("Procedure custom.rollback_to_snapshot not found");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.rollback_to_snapshot('t')", catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [snapshot_id]");
+
+    Assertions.assertThatThrownBy(() -> sql("CALL 
%s.system.rollback_to_snapshot(1L)", catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [snapshot_id]");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.rollback_to_snapshot(table => 't')", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [snapshot_id]");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.rollback_to_snapshot('t', 2.2)", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Wrong arg type for snapshot_id: cannot cast 
DecimalType(2,1) to LongType");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.rollback_to_snapshot('', 1L)", 
catalogName))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot handle an empty identifier for argument table");
   }
 }
diff --git 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRollbackToTimestampProcedure.java
 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRollbackToTimestampProcedure.java
index 6da3853bbe..80af6e7f5f 100644
--- 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRollbackToTimestampProcedure.java
+++ 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRollbackToTimestampProcedure.java
@@ -21,7 +21,6 @@ package org.apache.iceberg.spark.extensions;
 import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Map;
-import org.apache.iceberg.AssertHelpers;
 import org.apache.iceberg.Snapshot;
 import org.apache.iceberg.Table;
 import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
@@ -29,6 +28,7 @@ import org.apache.spark.sql.AnalysisException;
 import org.apache.spark.sql.Dataset;
 import org.apache.spark.sql.Row;
 import org.apache.spark.sql.catalyst.analysis.NoSuchProcedureException;
+import org.assertj.core.api.Assertions;
 import org.junit.After;
 import org.junit.Assume;
 import org.junit.Test;
@@ -255,50 +255,48 @@ public class TestRollbackToTimestampProcedure extends 
SparkExtensionsTestBase {
   public void testInvalidRollbackToTimestampCases() {
     String timestamp = "TIMESTAMP '2007-12-03T10:15:30'";
 
-    AssertHelpers.assertThrows(
-        "Should not allow mixed args",
-        AnalysisException.class,
-        "Named and positional arguments cannot be mixed",
-        () ->
-            sql(
-                "CALL %s.system.rollback_to_timestamp(namespace => 'n1', 't', 
%s)",
-                catalogName, timestamp));
-
-    AssertHelpers.assertThrows(
-        "Should not resolve procedures in arbitrary namespaces",
-        NoSuchProcedureException.class,
-        "not found",
-        () -> sql("CALL %s.custom.rollback_to_timestamp('n', 't', %s)", 
catalogName, timestamp));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.rollback_to_timestamp('t')", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.rollback_to_timestamp(timestamp => %s)", 
catalogName, timestamp));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.rollback_to_timestamp(table => 't')", 
catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with extra args",
-        AnalysisException.class,
-        "Too many arguments",
-        () ->
-            sql("CALL %s.system.rollback_to_timestamp('n', 't', %s, 1L)", 
catalogName, timestamp));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with invalid arg types",
-        AnalysisException.class,
-        "Wrong arg type for timestamp: cannot cast",
-        () -> sql("CALL %s.system.rollback_to_timestamp('t', 2.2)", 
catalogName));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rollback_to_timestamp(namespace => 'n1', 
't', %s)",
+                    catalogName, timestamp))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Named and positional arguments cannot be mixed");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.custom.rollback_to_timestamp('n', 't', %s)", 
catalogName, timestamp))
+        .isInstanceOf(NoSuchProcedureException.class)
+        .hasMessage("Procedure custom.rollback_to_timestamp not found");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.rollback_to_timestamp('t')", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [timestamp]");
+
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rollback_to_timestamp(timestamp => %s)",
+                    catalogName, timestamp))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [table]");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.rollback_to_timestamp(table => 't')", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [timestamp]");
+
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rollback_to_timestamp('n', 't', %s, 1L)",
+                    catalogName, timestamp))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Too many arguments for procedure");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.rollback_to_timestamp('t', 2.2)", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Wrong arg type for timestamp: cannot cast 
DecimalType(2,1) to TimestampType");
   }
 }
diff --git 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSetCurrentSnapshotProcedure.java
 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSetCurrentSnapshotProcedure.java
index 8a8a974bbe..51db8d3210 100644
--- 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSetCurrentSnapshotProcedure.java
+++ 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSetCurrentSnapshotProcedure.java
@@ -22,15 +22,14 @@ import static 
org.apache.iceberg.TableProperties.WRITE_AUDIT_PUBLISH_ENABLED;
 
 import java.util.List;
 import java.util.Map;
-import org.apache.iceberg.AssertHelpers;
 import org.apache.iceberg.Snapshot;
 import org.apache.iceberg.Table;
-import org.apache.iceberg.catalog.Namespace;
 import org.apache.iceberg.exceptions.ValidationException;
 import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
 import org.apache.iceberg.relocated.com.google.common.collect.Iterables;
 import org.apache.spark.sql.AnalysisException;
 import org.apache.spark.sql.catalyst.analysis.NoSuchProcedureException;
+import org.assertj.core.api.Assertions;
 import org.junit.After;
 import org.junit.Assume;
 import org.junit.Test;
@@ -190,67 +189,54 @@ public class TestSetCurrentSnapshotProcedure extends 
SparkExtensionsTestBase {
   public void testSetCurrentSnapshotToInvalidSnapshot() {
     sql("CREATE TABLE %s (id bigint NOT NULL, data string) USING iceberg", 
tableName);
 
-    Namespace namespace = tableIdent.namespace();
-    String tableName = tableIdent.name();
-
-    AssertHelpers.assertThrows(
-        "Should reject invalid snapshot id",
-        ValidationException.class,
-        "Cannot roll back to unknown snapshot id",
-        () -> sql("CALL %s.system.set_current_snapshot('%s', -1L)", 
catalogName, tableIdent));
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.set_current_snapshot('%s', -1L)", 
catalogName, tableIdent))
+        .isInstanceOf(ValidationException.class)
+        .hasMessage("Cannot roll back to unknown snapshot id: -1");
   }
 
   @Test
   public void testInvalidRollbackToSnapshotCases() {
-    AssertHelpers.assertThrows(
-        "Should not allow mixed args",
-        AnalysisException.class,
-        "Named and positional arguments cannot be mixed",
-        () ->
-            sql(
-                "CALL %s.system.set_current_snapshot(namespace => 'n1', table 
=> 't', 1L)",
-                catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should not resolve procedures in arbitrary namespaces",
-        NoSuchProcedureException.class,
-        "not found",
-        () -> sql("CALL %s.custom.set_current_snapshot('n', 't', 1L)", 
catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.set_current_snapshot('t')", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.set_current_snapshot(1L)", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.set_current_snapshot(snapshot_id => 1L)", 
catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.set_current_snapshot(table => 't')", 
catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with invalid arg types",
-        AnalysisException.class,
-        "Wrong arg type for snapshot_id: cannot cast",
-        () -> sql("CALL %s.system.set_current_snapshot('t', 2.2)", 
catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with empty table identifier",
-        IllegalArgumentException.class,
-        "Cannot handle an empty identifier",
-        () -> sql("CALL %s.system.set_current_snapshot('', 1L)", catalogName));
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.set_current_snapshot(namespace => 'n1', 
table => 't', 1L)",
+                    catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Named and positional arguments cannot be mixed");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.custom.set_current_snapshot('n', 't', 1L)", 
catalogName))
+        .isInstanceOf(NoSuchProcedureException.class)
+        .hasMessage("Procedure custom.set_current_snapshot not found");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.set_current_snapshot('t')", catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [snapshot_id]");
+
+    Assertions.assertThatThrownBy(() -> sql("CALL 
%s.system.set_current_snapshot(1L)", catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [snapshot_id]");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.set_current_snapshot(snapshot_id => 
1L)", catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [table]");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.set_current_snapshot(table => 't')", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [snapshot_id]");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.set_current_snapshot('t', 2.2)", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Wrong arg type for snapshot_id: cannot cast 
DecimalType(2,1) to LongType");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.set_current_snapshot('', 1L)", 
catalogName))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot handle an empty identifier for argument table");
   }
 }
diff --git 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSnapshotTableProcedure.java
 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSnapshotTableProcedure.java
index ed64ef3315..6e2bf99c54 100644
--- 
a/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSnapshotTableProcedure.java
+++ 
b/spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestSnapshotTableProcedure.java
@@ -20,11 +20,11 @@ package org.apache.iceberg.spark.extensions;
 
 import java.io.IOException;
 import java.util.Map;
-import org.apache.iceberg.AssertHelpers;
 import org.apache.iceberg.Table;
 import org.apache.iceberg.TableProperties;
 import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
 import org.apache.spark.sql.AnalysisException;
+import org.assertj.core.api.Assertions;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Assume;
@@ -195,37 +195,30 @@ public class TestSnapshotTableProcedure extends 
SparkExtensionsTestBase {
         "CREATE TABLE %s (id bigint NOT NULL, data string) USING parquet 
LOCATION '%s'",
         sourceName, location);
 
-    AssertHelpers.assertThrows(
-        "Should reject calls without all required args",
-        AnalysisException.class,
-        "Missing required parameters",
-        () -> sql("CALL %s.system.snapshot('foo')", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with invalid arg types",
-        AnalysisException.class,
-        "Wrong arg type",
-        () -> sql("CALL %s.system.snapshot('n', 't', map('foo', 'bar'))", 
catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with invalid map args",
-        AnalysisException.class,
-        "The `map` requires 2n (n > 0) parameters but the actual number is 3",
-        () ->
-            sql(
-                "CALL %s.system.snapshot('%s', 'fable', 'loc', map(2, 1, 1))",
-                catalogName, sourceName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with empty table identifier",
-        IllegalArgumentException.class,
-        "Cannot handle an empty identifier",
-        () -> sql("CALL %s.system.snapshot('', 'dest')", catalogName));
-
-    AssertHelpers.assertThrows(
-        "Should reject calls with empty table identifier",
-        IllegalArgumentException.class,
-        "Cannot handle an empty identifier",
-        () -> sql("CALL %s.system.snapshot('src', '')", catalogName));
+    Assertions.assertThatThrownBy(() -> sql("CALL %s.system.snapshot('foo')", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessage("Missing required parameters: [table]");
+
+    Assertions.assertThatThrownBy(
+            () -> sql("CALL %s.system.snapshot('n', 't', map('foo', 'bar'))", 
catalogName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessageStartingWith("Wrong arg type for location");
+
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.snapshot('%s', 'fable', 'loc', map(2, 1, 
1))",
+                    catalogName, sourceName))
+        .isInstanceOf(AnalysisException.class)
+        .hasMessageContaining(
+            "The `map` requires 2n (n > 0) parameters but the actual number is 
3");
+
+    Assertions.assertThatThrownBy(() -> sql("CALL %s.system.snapshot('', 
'dest')", catalogName))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot handle an empty identifier for argument 
source_table");
+
+    Assertions.assertThatThrownBy(() -> sql("CALL %s.system.snapshot('src', 
'')", catalogName))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot handle an empty identifier for argument table");
   }
 }

Reply via email to