I followed this blog post which shows how to mock queries using Mockito and Retrofit. The problem is that I use both Robospice methods, for which it is not necessary to provide a parameter Callbackin the service interface (since this will be a synchronous call ):
@GET("/foo/bar")
User foo(@Query("bar") String baz);
Therefore, I cannot intercept the callback of my tests as follows:
Mockito.verify(mockApi).repositories(Mockito.anyString(), cb.capture());
User user = new User();
cb.getValue().success(user, null);
Is there any way to achieve this? Thank!
source
share