jackye1995 commented on a change in pull request #4254:
URL: https://github.com/apache/iceberg/pull/4254#discussion_r821184525



##########
File path: core/src/test/java/org/apache/iceberg/TestCatalogUtil.java
##########
@@ -158,6 +160,26 @@ public void loadCustomFileIO_badClass() {
         () -> CatalogUtil.loadFileIO(TestFileIONotImpl.class.getName(), 
Maps.newHashMap(), null));
   }
 
+  @Test public void loadFileIOMetricsContext() {
+    Map<String, String> properties = Maps.newHashMap();
+    properties.put(CatalogProperties.IO_METRICS_NAMESPACE, "testScheme");
+    MetricsContext metricsContext = CatalogUtil.loadFileIOMetricsContext(
+            TestFileIOMetricsContext.class.getName(), properties, null);
+    TestFileIOMetricsContext testMetricsContext = (TestFileIOMetricsContext) 
metricsContext;
+
+    
Assertions.assertThat(metricsContext).isInstanceOf(TestFileIOMetricsContext.class);
+    Assert.assertEquals("testScheme", testMetricsContext.scheme());
+  }
+
+  @Test public void loadBadFileIOMetricsContext() {
+    Map<String, String> properties = Maps.newHashMap();
+    MetricsContext metricsContext = CatalogUtil.loadFileIOMetricsContext(
+            "BadMetricsContext", properties, null);
+
+    MetricsContext nullMetricsContext = MetricsContext.nullMetrics();

Review comment:
       nit: can directly do `Assert.assertEquals(MetricsContext.nullMetrics(), 
metricsContext);`




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