@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"); }
public Observable<String> getPokemonAbilityStringObservable(String id) { return pokemonService.getPokemon(id) .map(new Function<Pokemon, String>() { @Override public String apply(@NonNull Pokemon pokemon) throws Exception { return constructAbility(pokemon); } }); }
PokeDataSource { public Observable<String> getPokemonAbilityStringObservable(String id) { return pokemonService.getPokemon(id) .map(new Function<Pokemon, String>() { @Override public String apply(@NonNull Pokemon pokemon) throws Exception { return constructAbility(pokemon); } }); } }
PokeDataSource { public Observable<String> getPokemonAbilityStringObservable(String id) { return pokemonService.getPokemon(id) .map(new Function<Pokemon, String>() { @Override public String apply(@NonNull Pokemon pokemon) throws Exception { return constructAbility(pokemon); } }); } @Inject  PokeDataSource(PokemonService pokemonService); }
PokeDataSource { public Observable<String> getPokemonAbilityStringObservable(String id) { return pokemonService.getPokemon(id) .map(new Function<Pokemon, String>() { @Override public String apply(@NonNull Pokemon pokemon) throws Exception { return constructAbility(pokemon); } }); } @Inject  PokeDataSource(PokemonService pokemonService); Observable<String> getPokemonStringObservable(String id); Observable<String> getPokemonAbilityStringObservable(String id); }
PokeDataSource { public Observable<String> getPokemonAbilityStringObservable(String id) { return pokemonService.getPokemon(id) .map(new Function<Pokemon, String>() { @Override public String apply(@NonNull Pokemon pokemon) throws Exception { return constructAbility(pokemon); } }); } @Inject  PokeDataSource(PokemonService pokemonService); Observable<String> getPokemonStringObservable(String id); Observable<String> getPokemonAbilityStringObservable(String id);  }