https://kotlinlang.org logo
Title
d

darych

03/19/2019, 1:10 PM
Hi all! Could somebody please explain what this error means?
io.mockk.MockKException: Failed matching mocking signature for\n\nleft matchers: [any(), any(), any()]
Version 1.8.9 Code:
every { clientFactory.invoke(any(), any(), any()) } returns client
clientFactory
is factory function which returns the object of client.
Also if I specify exact arguments in function I receive
io.mockk.MockKException: Missing calls inside every { ... } block.
l

LeoColman

03/19/2019, 1:30 PM
Are you sure client factory is mocked?
👍 1
d

darych

03/19/2019, 1:32 PM
Yes, previously it went to real execution instead of mocking. As I know mockk does not use real execution, am I right?
Hm, checked again. I'm not sure that it's mocked....
l

LeoColman

03/19/2019, 1:37 PM
You can only use
every { XX }
when XX is mocked
If you want some of it mocked and some of it real impl, you can use
spykk
instead
d

darych

03/19/2019, 1:38 PM
Yes, I know that... It's surprise to me that object is not mocked...
l

LeoColman

03/19/2019, 1:38 PM
Happens to all of us 😛
Did it work again?
d

darych

03/19/2019, 1:39 PM
Nope... I'm injecting mockk using Spring and test configuration because i'm testing spring controller...
OMG. I don't know what has changed. But now it's working... Thank you @LeoColman! 🙂
l

LeoColman

03/19/2019, 1:43 PM
😄