I am trying to write unit test cases for a Kotlin class A and trying to mock return client() call present in test() method to unit test test() method:
A.kt kotlin class:
class A (par 1, par 2) : B(par 1, par 2) {
override fun test(item: String): Boolean {
return client()
}
}
B.kt kotlin class:
abstract class B(par 1, par 2) {
private val client: WebClient by lazy {
//does something
}
protected fun client(): WebClient = client
}
Is it possible to mock the client() call in test() method? And if possible how to do it and what library should I use for mocking?