Apollo-android: Allow ApolloClient to be Proxied

Created on 17 Oct 2018  路  5Comments  路  Source: apollographql/apollo-android

https://github.com/spring-projects/spring-boot/issues/14879#issuecomment-430777067

Can ApolloClient please not be final, or maybe have a single interface that composes the 4 factory interfaces? Right now my client will be fine with just mutation, but if I wanted to do read/write in the same interface I'd have to inject 2 or more of them. Interface method is preferred, imho.

Enhancement

Most helpful comment

yes, but I can't make your class use my interface, and it's final, thus I can't extend it... but you're right, that's how you would patch this... so what exactly do you expect? me to reimplement a full delegate? the real alternative to a 5th interface is to have the class not be final so proxies and mockito can extend it.

All 5 comments

And final makes it hard to mock via mockito. Using mock-maker-inline as work around.

you can make a single interface by extending the 4 interfaces. I'm not sure if conflating interfaces together for general use is what we want.

yes, but I can't make your class use my interface, and it's final, thus I can't extend it... but you're right, that's how you would patch this... so what exactly do you expect? me to reimplement a full delegate? the real alternative to a 5th interface is to have the class not be final so proxies and mockito can extend it.

Misunderstood the issue sorry. Reopening

Closing out of date. You can always mock raw http server request if needed with https://github.com/square/okhttp/tree/master/mockwebserver

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pratthama-appdesk picture pratthama-appdesk  路  3Comments

RageshAntony picture RageshAntony  路  3Comments

TonnyL picture TonnyL  路  3Comments

john-lanticse picture john-lanticse  路  3Comments

AOrobator picture AOrobator  路  3Comments