Open pauliktamas opened 7 years ago
@pauliktamas Observable.just(...) powerful for stub response success, Observable.error(exception) just response have a exception.
Information is not enough, I'm not sure best answer for your problem.
@WeRockStar thank you for the response, I found a solution but I have no idea why it didn't work for me as it does for you.
You simply return Observable.error(exception) but for some reason I have to return:
Observable.<ServerInfo>error(exception)
(ServerInfo is simply a model class)
Edit: I haven't tested it, but it might be because you use Java 1.8 and I use 1.7. As far as I know 1.8 lets you simplify a lot of "obvious" parts of the code, that's why you didn't have to tell the type before error(...)
Hello there!
I'm trying to do the same test case for my project like you did in should_see_error() test, but for some reason I get a weird error and can't run the test.
What you have:
What I have:
For the Observable.error(exception) part I always get "Cannot resolve method 'thenReturn(rx.Observable)'" error message. I was wondering if you have seen this problem and maybe know the solution for it. I changed all my gradle dependencies to the same versions that you have but still no luck.
On the other hand with the Observable.just(...) when I'm testing successful API calls it works like a charm.
Thank you!