https://kotlinlang.org logo
Title
u

user

07/08/2022, 12:11 AM
How do I set a default Answer strategy with Mockk In Mockito, I can create a mock of a class, and specify the default answer for any function calls to that mock, like this: whenever(this.strings).thenReturn(mock(StringProvider::class.java, StringProviderAnswer())) Where the answer might be class StringProviderAnswer : Answer { private val delegate = Mockito.RETURNS_DEFAULTS!! override fun answer(invocation: InvocationOnMock?): Any? { val invocationMethodReturn = invocation?.method?.returnType val stringType =...