So I have a class
class Test<T : SomeListener> @Inject constructor(
private val dependency1: Dependency1,
private val listener: T
)
I'm trying to write a unit test for it using mockk and running into an error when trying to mock and initialize it with the generic type.
class TestTest {
@MockK
lateinit var dependency1: Dependency1
@MockK
lateinit var listener: ListenerImpl
@InjectMockKs(overrideValues = true)
lateinit var testObject: Test<ListenerImpl>
}
I keep getting an error "io.mockk.MockKException: No matching constructors found: ... listener : T =
What is the right way to get it to mock the constructor correctly with this generic parameter value?