Luiz Aguiar
03/18/2021, 10:08 PMfun <T : Any> myFunction(foo: Foo, bar: Bar, response: KClass<T>): MyResponse<T> { do magic }
how can it be mocked to control the returned object?
whenever(mockedClass.myFunction(any(), any(), any<SomeType>())).thenReturn(MyResponse<SomeType>())
I tried few variations with mockito/mokk but the argument matcher never works.Jordan Foo
03/19/2021, 12:10 AMevery { mockedClass.myFunction(any(), any(), ofType(SomeType::class) } returns SomeType()
A bit hard to say when your example doesn't quite match up (Any vs SomeType)Jilles van Gurp
03/19/2021, 8:08 AMmockkStatic
https://notwoods.github.io/mockk-guidebook/docs/mocking/static/Luiz Aguiar
03/19/2021, 10:09 AMType mismatch.
Required: KClass<TypeVariable(T)>
Found: SomeType