0
JMock의 onConsecutiveCalls 메소드가 전달 된 매개 변수 목록의 끝에 도달하면 전달 된 첫 번째 동작으로 루프하도록 설정하는 방법이 있습니까? 아래 샘플 코드에서 모의를 true->false->true->Ad infinitum
으로 반환하고 싶습니다.Jmock 루프 연속 호출
모의 설정 :
final MyService myServiceMocked = mockery.mock(MyService.class);
mockery.checking(new Expectations() {{
atLeast(1).of(myServiceMocked).doSomething(with(any(String.class)), with(any(String.class)));
will (onConsecutiveCalls(
returnValue(true),
returnValue(false)
));
}});
방법 전화 해봐요 방법 : 다음, 내 테스트 클래스에 다음을 추가하는 대신에 onRecurringConsecutiveCalls()
를 호출하여이 문제를 해결 가지고
...
for (String id:idList){
boolean first = getMyService().doSomething(methodParam1, someString);
boolean second = getMyService().doSomething(anotherString, id);
}
...