Skip to content

Instantly share code, notes, and snippets.

@ragdroid
Last active March 10, 2017 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ragdroid/0d0277d7cb0e34bfbe2f2ba49fcf266a to your computer and use it in GitHub Desktop.
Save ragdroid/0d0277d7cb0e34bfbe2f2ba49fcf266a to your computer and use it in GitHub Desktop.
Testing DataSource with Mockito
@Inject PokeService pokemonService;
@Test
public void testGetPokemonAbilityStringObservable() {
PokeDataSource dataSource = new PokeDataSource(pokemonService);
TestObserver observer = new TestObserver();
dataSource.getPokemonAbilityStringObservable("12")
.subscribe(observer);
observer.assertNoErrors();
observer.awaitTerminalEvent();
observer.assertComplete();
observer.assertValue("Id: 12\n" +
"Name: butterfreeAbility Name : tinted-lens\n" +
" Is Hidden : true");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment