Last active
August 27, 2015 06:55
-
-
Save patrykpoborca/bc82d716c53e995aa786 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MockRetrofit extends Retrofit { | |
private static final String MOCK_PARSE = "SomeMockResponse"; | |
public static final String MOCKED_STRING = "MOCKED PAGE:"; | |
public MockRetrofit(OKHttp okHttp, Scheduler mainScheduler) { | |
super(okHttp, mainScheduler); | |
} | |
@Override | |
public Observable<String> completeRequest() { | |
return Observable.just(okHttp.rawResponse() + MOCK_PARSE) | |
.observeOn(mainScheduler); | |
} | |
@Override | |
public Observable<String> fetchSomePage(String url) { | |
return Observable.just("<h2>" + MOCKED_STRING + " " + url + " </h2>") | |
.observeOn(mainScheduler); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment