You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "nastra (via GitHub)" <gi...@apache.org> on 2023/05/01 09:59:03 UTC

[GitHub] [iceberg] nastra commented on a diff in pull request #7482: Hive: Remove deprecated AssertHelpers

nastra commented on code in PR #7482:
URL: https://github.com/apache/iceberg/pull/7482#discussion_r1181492855


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCatalog.java:
##########
@@ -410,39 +403,40 @@ public void testCreateNamespaceWithOwnership() throws Exception {
         "iceberg",
         PrincipalType.GROUP);
 
-    AssertHelpers.assertThrows(
-        String.format(
-            "Create namespace setting %s without setting %s is not allowed",
-            HiveCatalog.HMS_DB_OWNER_TYPE, HiveCatalog.HMS_DB_OWNER),
-        IllegalArgumentException.class,
-        () -> {
-          try {
-            createNamespaceAndVerifyOwnership(
-                "create_with_owner_type_alone",
-                ImmutableMap.of(HiveCatalog.HMS_DB_OWNER_TYPE, PrincipalType.USER.name()),
-                "no_post_create_expectation_due_to_exception_thrown",
-                null);
-          } catch (TException e) {
-            throw new RuntimeException("Unexpected Exception", e);
-          }
-        });
-
-    AssertHelpers.assertThrows(
-        "No enum constant " + PrincipalType.class.getCanonicalName(),
-        IllegalArgumentException.class,
-        () -> {
-          try {
-            createNamespaceAndVerifyOwnership(
-                "create_with_invalid_owner_type",
-                ImmutableMap.of(
-                    HiveCatalog.HMS_DB_OWNER, "iceberg",
-                    HiveCatalog.HMS_DB_OWNER_TYPE, "invalidOwnerType"),
-                "no_post_create_expectation_due_to_exception_thrown",
-                null);
-          } catch (TException e) {
-            throw new RuntimeException("Unexpected Exception", e);
-          }
-        });
+    assertThatThrownBy(
+            () -> {
+              try {
+                createNamespaceAndVerifyOwnership(
+                    "create_with_owner_type_alone",
+                    ImmutableMap.of(HiveCatalog.HMS_DB_OWNER_TYPE, PrincipalType.USER.name()),
+                    "no_post_create_expectation_due_to_exception_thrown",
+                    null);
+              } catch (TException e) {

Review Comment:
   I think we should remove those try-catch blocks as they are not needed



##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveSchemaUtil.java:
##########
@@ -147,13 +147,12 @@ public void testSchemaConvertToIcebergSchemaForEveryPrimitiveType() {
   @Test
   public void testNotSupportedTypes() {
     for (FieldSchema notSupportedField : getNotSupportedFieldSchemas()) {
-      AssertHelpers.assertThrows(
-          "should throw exception",
-          IllegalArgumentException.class,
-          "Unsupported Hive type",
-          () -> {
-            HiveSchemaUtil.convert(Lists.newArrayList(Arrays.asList(notSupportedField)));
-          });
+      Assertions.assertThatThrownBy(
+              () -> {

Review Comment:
   nit: can we remove the {} wrapping here?



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org