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 mocking not working when receiving null on methods with many signatures #871
Comments
You cannot stub method with two signatures in one stub. You need to precise which signature you are stubbing. Use |
Hi @postapczuk I also tried that, and I'm still getting the same. Tried this:
|
+1 Neither calling with |
What are you testing in your test? It doesn't make sense: First you're stubing: And then you test this stub: If you're testing the static method, you shouldn't do the stub. If you're testing some class that is use Foo's static method you should change 'when' section to use method from that class, not from Foo. |
@fogrizovic , actually |
I think You can't use GroovyMock for testing the Java static method. The methods under MockingApi like GroovyMock, GroovySpy are specific to Groovy Please refer the same in the Spock doc: http://spockframework.org/spock/docs/1.0/interaction_based_testing.html (Groovy Mocks (New in 0.7) |
@ssrinathraju it depends. The problem ist most probably more how the mocks are implemented and that they don't carry over the cast to the method selection or something similar. |
Hi,
I'm trying to stub a static method from Java class, which has more than one signature. Like this
Foo is a java class with mehtod "generate" defined as:
Then I'm getting:
Is this the expected behaviour? How can I call generate with "null" value?
The text was updated successfully, but these errors were encountered: