### Question:
ReflectionUtil { public static Method getMethod(Class<?> classType, String methodName, Class<?>[] parameterTypes) throws NoSuchMethodException, SecurityException { return classType.getMethod(methodName, parameterTypes); }  static Class<?> getClassByName(String className); static Object getFieldValue(Object target, String fieldName); static Object invokeMethod(Object target, String methodName); static Object invokeMethod(Object target, String methodName, Class<?>[] parameterTypes, Object[] args); static Object invokeStaticMethod(Class<?> targetClass, String methodName, Class<?>[] parameterTypes,
                                            Object[] parameterValues); static Method getMethod(Class<?> classType, String methodName, Class<?>[] parameterTypes); static Set<Class<?>> getInterfaces(Class<?> clazz); static void modifyStaticFinalField(Class cla, String modifyFieldName, Object newValue); static final int MAX_NEST_DEPTH; }### Answer:
@Test public void testGetMethod() throws NoSuchMethodException { Assertions.assertEquals("public int java.lang.String.length()", ReflectionUtil.getMethod(String.class, "length", null) .toString()); Assertions.assertEquals("public char java.lang.String.charAt(int)", ReflectionUtil.getMethod(String.class, "charAt", new Class<?>[]{int.class}).toString()); Assertions.assertThrows(NoSuchMethodException.class, () -> ReflectionUtil.getMethod(String.class, "size", null)); }