danny0405 commented on code in PR #5434:
URL: https://github.com/apache/hudi/pull/5434#discussion_r860567134


##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/sink/utils/TestHiveSyncContext.java:
##########
@@ -0,0 +1,47 @@
+package org.apache.hudi.sink.utils;
+
+
+import org.apache.hudi.configuration.FlinkOptions;
+import org.apache.hudi.hive.HiveSyncConfig;
+import org.junit.jupiter.api.Test;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import org.apache.flink.configuration.Configuration;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Test cases for {@link HiveSyncContext}.
+ */
+public class TestHiveSyncContext {
+    /**
+     * Test that the file ids generated by the task can finally shuffled to 
itself.
+     */
+    @Test
+    void testBuildSyncConfig() throws ClassNotFoundException, 
NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+        Configuration configuration1 = new Configuration();
+        Configuration configuration2 = new Configuration();
+        String hiveSyncPartitionField = "hiveSyncPartitionField";
+        String partitionPathField = "partitionPathField";
+
+        configuration1.setString(FlinkOptions.HIVE_SYNC_PARTITION_FIELDS, 
hiveSyncPartitionField);
+        configuration1.setString(FlinkOptions.PARTITION_PATH_FIELD, 
partitionPathField);
+
+        configuration2.setString(FlinkOptions.PARTITION_PATH_FIELD, 
partitionPathField);
+
+        Class<?> threadClazz = 
Class.forName("org.apache.hudi.sink.utils.HiveSyncContext");
+        Method buildSyncConfigMethod = 
threadClazz.getDeclaredMethod("buildSyncConfig", Configuration.class);

Review Comment:
   Usually we do not use the reflection to make method visible, you can just 
make the method public and tag it with annotation
   ```java
   @VisibleForTesting
   ```



##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/sink/utils/TestHiveSyncContext.java:
##########
@@ -0,0 +1,47 @@
+package org.apache.hudi.sink.utils;
+
+
+import org.apache.hudi.configuration.FlinkOptions;
+import org.apache.hudi.hive.HiveSyncConfig;
+import org.junit.jupiter.api.Test;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import org.apache.flink.configuration.Configuration;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Test cases for {@link HiveSyncContext}.
+ */
+public class TestHiveSyncContext {
+    /**
+     * Test that the file ids generated by the task can finally shuffled to 
itself.
+     */
+    @Test
+    void testBuildSyncConfig() throws ClassNotFoundException, 
NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+        Configuration configuration1 = new Configuration();

Review Comment:
   `throws Exception` is ok.



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

Reply via email to