https://kotlinlang.org logo
#mockk
Title
# mockk
a

aherbel

04/07/2022, 6:45 PM
hi anyone knows the equivalente of
on
on Mockito but in MockK? I need to change the response type of an
every
call but I found no operator to do this as with the
on
operator in Mockito
e

ephemient

04/07/2022, 6:59 PM
there should be no need for it, what are you trying to do?
a

aherbel

04/07/2022, 7:01 PM
I need to mock a response from a Call<T> Retrofit call
the thing is that I when I call the method, it returns a Call<T> type and I need to return another type
e

ephemient

04/07/2022, 7:23 PM
I still don't understand what you're trying to do - even if it's a mock, whatever you return still has to be a Call<T> - and on() doesn't change that
but since you mentioned Retrofit - there's plenty of pre-built fake calls already, https://github.com/square/retrofit/blob/master/retrofit-mock/src/main/java/retrofit2/mock/Calls.java
3 Views