New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global Groovy mock doesn't work as expected #785
Comments
I also find a weird situation when I try to use global GroovySpy. I copied the unit test example here:
The above test case failed which gives me this error:
The only thing I changed is the order of mock and actual creation of the instance. Can someone explain why this test case fails? |
I have similar issue:
but when I try to execute such test case -- mock behaviour defined in then clause not working and someMockObject.callSomeMethod() always return null. Spock version is 1.3-groovy-2.5 |
@flyingclamking So I guess the issue is, that you are creating the Also to your first example, if you create the @leonard84 Maybe we should state in the documentation that the order of declaration for a |
Added test case base documentation for global mocks. And clarify the usage of the global mock and lifecycle. This fixes spockframework#785
Added test case base documentation for global mocks. And clarify the usage of the global mock and lifecycle. This fixes #785
Hello, I made a unit test example based on the documentation here:
http://spockframework.org/spock/docs/1.1/interaction_based_testing.html
Specifically, I am following the example under the section: Mocking All Instances of a Type
Here is my code:
After running these 2 tests, the first one passes. However the second one failed with below error:
I would expect the second test passes as well, did I miss something in the test? Please help!
Here is my local env: (and I am using latest spock: spock-core:1.1-groovy-2.4-rc-3)
Gradle 4.2
Build time: 2017-09-20 14:48:23 UTC
Revision: 5ba503cc17748671c83ce35d7da1cffd6e24dfbd
Groovy: 2.4.11
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_102 (Oracle Corporation 25.102-b14)
OS: Linux 4.10.0-35-generic amd64
The text was updated successfully, but these errors were encountered: