Hi guys, I am currently using `mockito-kotlin` in ...
# test
s
Hi guys, I am currently using
mockito-kotlin
in my project, and I saw from the docs that I can assign a property to a mock without actually having to use stubs. But this does not seem to be working in my code.
Copy code
@Test
fun testCase() {
    val entity = mock<Entity>()
    entity.property = Property()
    assert(entity.property != null) // fails
}
Or does it only work with primitive types or interfaces?
d
Maybe I missed this, but since mockito-kotlin is just a warpper around kotlin it should not be possible to use anything other than
whenever(entity.property).thenReturn(Property())
Or
mock<Entity> { on { property } doReturn Property() }
for short