@Test
    @SuppressWarnings("all")
    public void testGetAndSet() throws Exception {
        Class<?> clazz = getTargetClass();
        Object target = clazz.getDeclaredConstructor().newInstance();
        Field[] fields = clazz.getDeclaredFields();
        Set<String> excludeFields = getExcludeFields();

        Stream.of(fields)
                .forEach(f -> {
                    if (f.isSynthetic()) {
                        return;
                    }
                    if (Objects.nonNull(excludeFields) && excludeFields.contains(f.getName())) {
                        return;
                    }
                    try {
                        // get the get and set methods of the field by PropertyDescriptor
                        // (String) f.getName() for java11 (can not find com.sun.beans.introspect.PropertyInfo class)
                        PropertyDescriptor property = new PropertyDescriptor((String) f.getName(), clazz);
                        Method getter = property.getReadMethod();
                        Method setter = property.getWriteMethod();

                        final Object setValue = defaultValue(property.getPropertyType());

                        setter.invoke(target, setValue);
                        final Object getValue = getter.invoke(target);
                        assertEquals(setValue, getValue,
                                property.getDisplayName() + " getter / setter do not produce the same result."
                        );
                    } catch (IntrospectionException | IllegalAccessException | InvocationTargetException | InstantiationException e) {
                        throw new RuntimeException("", e);
                    }
                });
    }
Test getter and setter method by reflect.

@throws Exception maybe throw reflect Exception.
shenyu-admin/src/test/java/org/apache/shenyu/admin/AbstractReflectGetterSetterTest.java