jmockit 模拟同一个函数多次调用每次返回不同结果

new Expectations(){{
calendarService.getGeneralCalendar((Date)any);
returns(null, new AbrahamResult<HolidayCalendar>() {{setSuccess(false);}},
new AbrahamResult<HolidayCalendar>() {{setSuccess(true);
setResult(holidayCalendar);}});
times =3;
}};

result = xx;// 每次返回结果都相同
returns(第一次结果,第二次结果,第n次结果)//按调用的次数返回指定结果
原文地址:https://www.cnblogs.com/yangming0322/p/9134451.html