+ public static <T> T callPrivateMethod(Object object, String methodName) {
+ try {
+ Method method = object.getClass().getDeclaredMethod(methodName, new Class[0]);
+ method.setAccessible(true);
+ return (T) method.invoke(object);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+