When I built a structure like the one below, I saw that the classes that are not executed through the interface
can also be mockable.
How does this work? Could it be related to Kotlin
?
In fact, my question here is; How does it crush the function of a class without override
? I'm curious about the background of this.
class Sample {
fun returnFive() = 5
}
@Test
fun test(){
var sample = Sample()
sample = mockk {
every { returnFive() } returns 10
}
assertEquals(5,sample.returnFive())
}