Smorg
01/04/2019, 7:25 AMmockito-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.
@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?Daniel
01/04/2019, 11:02 AMwhenever(entity.property).thenReturn(Property())
Daniel
01/04/2019, 11:03 AMmock<Entity> { on { property } doReturn Property() }
for short