I'm using the Mosby Library to implement MVP pattern along with Retrofit and RxJava for my api calls almost exactly as it's done here.
I have just began with UI and Unit testing and while I've had no problems mocking my api during my UI testing (with MockWebServer), I can't figure out how to mock my api for Unit testing.
I've looked at the answer here but it seems like it's still trying to make the real api call since I see it's landing on onError (network exception) instead of onNext/onComplete. If I user MockWebServer it will also land on onError but not the network type.
What I want: When the presenter makes the api call :
signUpSubscriber = api.signUpUser(credentials)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(new Subscriber<User>()
To not actually make the call, but rather to be able to give it the "User" object it's supposed to return so that the test can pass on to onNext and onComplete