Skip to content

Instantly share code, notes, and snippets.

@NorseDreki
Created January 28, 2015 05:41
Show Gist options
  • Save NorseDreki/81d5a342f704d7088689 to your computer and use it in GitHub Desktop.
Save NorseDreki/81d5a342f704d7088689 to your computer and use it in GitHub Desktop.
Example on how to test an Observable
@Test
public void testJson() throws Exception {
Observable<String> jsonObservable = MockResponse.generateJson(736L, 1, 1000, 5);
String json = jsonObservable.toBlocking().single();
System.out.println(json);
assertTrue(json.startsWith("{\"responseKey\":" + MockResponse.getResponseKey(736L) + ",\"delay\":1,\"itemSize\":1000,\"numItems\":5,\"items\""));
System.out.println("json: " + json);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment