mockk calls original class only instead of mockked results
I have this class that I need to test. I am thinking it is because I am creating a new instance of the class A:
class A {
fun getName() = "Name"
}
class B {
private a = A()
fun amend(){
return "${a.getName()}-BName"
}
}
Now I want to test class B in BTest.kt
@Test
fun amendTest(){
val b = B()
val cls = mockk<A>()
//everytime getName is called return empty string
every { cls.getName() } returns ""
//call ammend method
val...