Reflection { public static @Nullable Method getMethod(@Nullable Class<?> clazz, String methodName, Class<?>... parameterTypes) { if (clazz == null) { return null; } try { return clazz.getMethod(methodName, parameterTypes); } catch (NoSuchMethodException e) { logger.debug(e.getMessage(), e); return null; } catch (Throwable t) { logger.warn(t.getMessage(), t); return null; } } private  Reflection(); static @Nullable Class<?> getClass(String name, @Nullable ClassLoader loader); static @Nullable Class<?> getClassWithWarnIfNotFound(String name,
            @Nullable ClassLoader loader); static @Nullable Method getMethod(@Nullable Class<?> clazz, String methodName,
            Class<?>... parameterTypes); static @Nullable Field getDeclaredField(@Nullable Class<?> clazz, String fieldName); @SuppressWarnings("unchecked") static T invoke(@Nullable Method method, Object obj,
            @Nullable Object... args); @SuppressWarnings("unchecked") static T invokeWithDefault(@Nullable Method method, Object obj, T defaultValue,
            @Nullable Object... args); static @Nullable Object getFieldValue(@Nullable Field field, Object obj);  }
@Test public void shouldReturnNullMethodWhenClassIsNull() { assertThat(Reflection.getMethod(null, null)).isNull(); }
@Test public void shouldReturnNullMethodWhenMethodNotFound() { assertThat(Reflection.getMethod(String.class, "thereWillNeverBeMethodWithThisName")) .isNull(); }