Assuming we have Activity.onCreate() like this
class MyActivity : AppCompatActivity() {
fun doSomething() {}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
doSomething()
}
}
I want to use MockK to verify if onCreate()
is invoked, then doSomething()
is invoked too. However I don't know how to mock the super.onCreate()
method.
Do you know any solution for this?
From what I see at https://github.com/mockk/mockk/issues/607 it seems currently unsupported - or not working.
The issue shows the Mockito way of solving this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.