pandaapo commented on code in PR #21752:
URL: https://github.com/apache/shardingsphere/pull/21752#discussion_r1005691458


##########
infra/util/src/test/java/org/apache/shardingsphere/infra/util/reflect/ReflectiveUtilTest.java:
##########
@@ -0,0 +1,43 @@
+package org.apache.shardingsphere.infra.util.reflect;
+
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+public class ReflectiveUtilTest {
+
+    @Test
+    public void testGetFieldValue() {
+        UserPojo pojo = new UserPojo("test");
+        String fieldValue = (String)ReflectiveUtil.getFieldValue(pojo, "foo");
+        assertTrue("test".equals(fieldValue));
+    }
+
+    @Test
+    public void testSetField() {
+        UserPojo pojo = new UserPojo();
+        ReflectiveUtil.setField(pojo, "foo", "test");
+        assertTrue("test".equals(pojo.getFoo()));
+    }
+
+    @Test
+    public void testSetStaticField() {
+        ReflectiveUtil.setStaticField(UserPojo.class, "bar", "test");
+        assertTrue("test".equals(UserPojo.bar));
+    }
+
+    @AllArgsConstructor
+    @NoArgsConstructor

Review Comment:
   The constructor with args was used in the test case.



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