https://kotlinlang.org logo
Title
n

Nidhin

07/31/2019, 7:40 AM
I’m trying to mock Spring mongo repository save(object) using mockk as below every { repositoryBean.save(any())} return Object(id=“1234”, timesatmp= 123446767, name= “sam”) but this shows me an error Type inference failed i also tried every { repositoryBean.save(Object(id=null, timestamp=any(), name=“sam”)} return Object(id=“1234", timesatmp= 123446767, name= “sam”) this also failed throwing Failed matching mocking signature for …..left matchers: [any(), any()] I don’t know the timestamp, as it is created dynamically and hence I can’t provide strict arguments can someone help me?
j

James Richardson

08/05/2019, 9:20 AM
Not directly answering your question.. but this may be of use: https://github.com/testdouble/contributing-tests/wiki/Don't-mock-what-you-don't-own