PowerMockito之测试私有变量赋值

Method sleep = PowerMockito.method(ParamRefreshFlowControlService.class, "sleep", StateSyncDataService.class,String.class);
MemberModifier.field(ParamRefreshFlowControlService.class, "sleepTime").set(spy, 42300L);
ParamFlowControlResEnum resEnum = (ParamFlowControlResEnum) sleep.invoke(spy, new DataProcessor(),SYNC_TASK_ID);

你可能感兴趣的:(测试中私有变量赋值,JUnit)