I have this code:
interface IFoo
class Foo:IFoo {
fun method(){
// ...
}
}
abstract class AbstractBar<T:IFoo>{
@Inject
lateinit var foo: T
}
class Bar: AbstractBar<Foo>() {
fun call(){
foo.method()
}
}
class Test {
@MockK
lateinit var foo: Foo
@InjectMockKs lateinit var bar: Bar
@Before
fun setUp() = MockKAnnotations.init(this)
@Test
fun test() {
every { foo.method() } answers { nothing }
bar.call()
verify { foo.method() }
}
}
and it produces an error:
kotlin.UninitializedPropertyAccessException: lateinit property foo has not been initialized
mockk version: 1.7.12
What do I need to do to get it right? or is it a bug?
I have this code:
and it produces an error:
kotlin.UninitializedPropertyAccessException: lateinit property foo has not been initializedmockk version: 1.7.12
What do I need to do to get it right? or is it a bug?