문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
java:spock [2016/09/27 14:14] kwon37xi |
java:spock [2017/07/10 20:43] kwon37xi [Dependencies] |
||
---|---|---|---|
줄 8: | 줄 8: | ||
===== Dependencies ===== | ===== Dependencies ===== | ||
< | < | ||
- | testCompile group: ' | + | testCompile group: ' |
testCompile group: ' | testCompile group: ' | ||
</ | </ | ||
줄 41: | 줄 41: | ||
} | } | ||
</ | </ | ||
+ | |||
===== Mock Argument Capture ===== | ===== Mock Argument Capture ===== | ||
[[http:// | [[http:// | ||
줄 59: | 줄 60: | ||
capturedEvent.newModel == newModel | capturedEvent.newModel == newModel | ||
capturedEvent.oldModel == oldModel | capturedEvent.oldModel == oldModel | ||
+ | </ | ||
+ | |||
+ | ===== Mock 선언이 작동하지 않을 때 ===== | ||
+ | * 대상 Class 혹은 Method가 '' | ||
+ | |||
+ | ===== Spy ===== | ||
+ | * '' | ||
+ | * Spy객체 생성 후 Spring의 [[https:// | ||
+ | |||
+ | ===== 오류 / Error ===== | ||
+ | * [[https:// | ||
+ | * 1.0 버전에서 메소드가 여러개 override 돼 있을 경우 Type 지정이 명확하지 않으면 잘못된 메소드를 호출할 수도 있다.< | ||
+ | // method 가 여러개로 override 돼 있을 경우 어떤 것이 호출될지 알 수 없음. 특히 return 도 서로 다를 때. | ||
+ | expect: | ||
+ | SomeClass.method(null) == null | ||
+ | |||
+ | // 아래와 같이 파라미터와 리턴 타입을 모두 명시할 것. | ||
+ | when: | ||
+ | Result result = SomeClass.method(null as Request) | ||
+ | then: | ||
+ | result == null | ||
</ | </ | ||