UserTest对象的name私有属性赋值
try {
Field field = payControllerUnderTest.getClass().getDeclaredField("name");
field.setAccessible(true); //粗爆的改成可访问,不管现有修饰
field.set(userTest,"zhangsan");
} catch (Exception e) {}
UserTest对象的name私有属性赋值
try {
Field field = payControllerUnderTest.getClass().getDeclaredField("name");
field.setAccessible(true); //粗爆的改成可访问,不管现有修饰
field.set(userTest,"zhangsan");
} catch (Exception e) {}