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

[GitHub] [iceberg] DaVincii commented on a diff in pull request #7853: Aliyun: Migrate tests to junit5 for aliyun client factory

DaVincii commented on code in PR #7853:
URL: https://github.com/apache/iceberg/pull/7853#discussion_r1235844115


##########
aliyun/src/test/java/org/apache/iceberg/aliyun/TestAliyunClientFactories.java:
##########
@@ -22,43 +22,30 @@
 import java.util.Map;
 import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
 import org.apache.iceberg.relocated.com.google.common.collect.Maps;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import static org.assertj.core.api.Assertions.assertThat;
 
 public class TestAliyunClientFactories {
 
   @Test
   public void testLoadDefault() {
-    Assert.assertEquals(
-        "Default client should be singleton",
-        AliyunClientFactories.defaultFactory(),
-        AliyunClientFactories.defaultFactory());
+    assertThat(AliyunClientFactories.defaultFactory()).as("Default client should be singleton").isEqualTo(AliyunClientFactories.defaultFactory());
 
     AliyunClientFactory defaultFactory = AliyunClientFactories.from(Maps.newHashMap());
-    Assert.assertTrue(
-        "Should load default when factory impl not configured",
-        defaultFactory instanceof AliyunClientFactories.DefaultAliyunClientFactory);
-    Assert.assertNull(
-        "Should have no Aliyun properties set", defaultFactory.aliyunProperties().accessKeyId());
+    assertThat(defaultFactory instanceof AliyunClientFactories.DefaultAliyunClientFactory).as("Should load default when factory impl not configured").isTrue();
+    assertThat(defaultFactory.aliyunProperties().accessKeyId()).as("Should have no Aliyun properties set").isNull();
 
     AliyunClientFactory defaultFactoryWithConfig =
         AliyunClientFactories.from(ImmutableMap.of(AliyunProperties.CLIENT_ACCESS_KEY_ID, "key"));
-    Assert.assertTrue(
-        "Should load default when factory impl not configured",
-        defaultFactoryWithConfig instanceof AliyunClientFactories.DefaultAliyunClientFactory);
-    Assert.assertEquals(
-        "Should have access key set",
-        "key",
-        defaultFactoryWithConfig.aliyunProperties().accessKeyId());
+    assertThat(defaultFactoryWithConfig instanceof AliyunClientFactories.DefaultAliyunClientFactory).as("Should load default when factory impl not configured").isTrue();
+    assertThat(defaultFactoryWithConfig.aliyunProperties().accessKeyId()).as("Should have access key set").isEqualTo("key");
   }
 
   @Test
   public void testLoadCustom() {
     Map<String, String> properties = Maps.newHashMap();
     properties.put(AliyunProperties.CLIENT_FACTORY, CustomFactory.class.getName());
-    Assert.assertTrue(
-        "Should load custom class",
-        AliyunClientFactories.from(properties) instanceof CustomFactory);
+    assertThat(AliyunClientFactories.from(properties) instanceof CustomFactory).as("Should load custom class").isTrue();

Review Comment:
   @nastra Thanks for the input, migrating Aliyun is bit complex as it contains test rules which needs to migrated to registerClass and extendWith in junit 5. For now I will park this and try the simpler ones and once I gain some expertise will look into this.



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