How to use spyk
I need to verify that a method has been called on an object. So I make a spy of this object: obj = spyk(obj) And then I verify that a method has been called: verify(exactly = 1) { obj.f(3) } The test fails with the following error message: java.lang.AssertionError: Verification failed: call 1 of 1: obj(#2).f(eq(3))) was not called. However I can clearly see the method f being called: I can break in that method in debug mode I print out hello world from f() in that method and see it being printed. How do I use spies correctly in mockk? P.S. I tried doing val obj = spyk(obj()) but I get lateinit
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.