I am trying to mock a sealed class which looks something like this:
sealed class Location
class Home: Location{
val name = "Home"
}
I would like to be able to do the following:
val mockHome = mockk<Home>() {
every { name } answers { "My Home" }
}
But unfortunately when I run this it fails with the following error:
io.mockk.MockKException: Missing calls inside every {... } block.
What am I doing wrong?
For now you cannot. but this issue was fixed in this PR and we are waiting for next release of Mockk. you can track this PR for more information
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.