https://kotlinlang.org logo
#mockk
Title
# mockk
s

svenjacobs

02/07/2019, 11:22 AM
Hi all, quick question: With MockK, how do I verify that a specific function of a mock was never called?
Copy code
verify {
  mock.myFunction(any()) wasNot called
}
Doesn't seem to be correct as this is always true, regardless of whether the function was called or not.
Copy code
verify(exactly = 0) {
   mock.myFunction(any))
}
works but is there another syntax when I want to verify calls an non-calls of functions in the same
verify
block?
o

oleksiyp

02/07/2019, 11:56 AM
No there is no
There is special syntax to check if mock had no calls
s

svenjacobs

02/07/2019, 12:14 PM
You mean
mock wasNot called
?
o

oleksiyp

02/07/2019, 12:38 PM
Yes
4 Views