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
Daniel
01/04/2019, 11:02 AM
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())
Daniel
01/04/2019, 11:03 AM
Or
mock<Entity> { on { property } doReturn Property() }