I am writing an unit test for methodOne and am trying to simulate an exception scenario.
Single<String> methodOne() {
methodTwo();
return Single.just("Hello");
}
Single<String> methodTwo() {
//some network calls
return Single.just("World");
}
I see that there are two ways to do thiswhen(test.methodTwo()).thenReturn(Single.error(new BadRequestException("bad request"));
when(test.methodTwo()).thenThrow(new BadRequestException("bad request"));
What is the difference between the two?
Trying to understand the difference between the above
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4