문서의 이전 판입니다!
testCompile group: 'org.spockframework', name: 'spock-core', version: '1.0-groovy-2.4' testCompile group: 'cglib', name: 'cglib-nodep', version: '3.2.4' // Class Mocking 할 때 필요.
How to do argument capture with spock framework? - Stack Overflow
SaveCommentEvent capturedEvent given: ... when: .... then: 1 * eventBus.fireEvent(_) >> {arguments -> capturedEvent=arguments[0] // capturing argument "some stub return value" } capturedEvent instanceof SaveModelEvent capturedEvent.newModel == newModel capturedEvent.oldModel == oldModel // 리턴값이 없을 경우 (stub이 아닐 경우) 1 * eventBus.fireEvent({capturedEvent = it; true})