Method method = UserImpl.class.getDeclaredMethod("getName",String.class);
method.setAccessible(true);
method.invoke(new UserImpl(),"zhangsan");
单测调用对象的私有方法
最新推荐文章于 2024-02-06 14:23:07 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)
Method method = UserImpl.class.getDeclaredMethod("getName",String.class);
method.setAccessible(true);
method.invoke(new UserImpl(),"zhangsan");