@Test public void testOnAddedHeader() throws InterruptedException { PokeDataSource dataSource = new PokeDataSource(pokemonService); TestObserver<String> observer = new TestObserver<>(); dataSource.getPokemonStringObservable("12").subscribe(observer); RecordedRequest recordedRequest = getMockWebServer().takeRequest(); assertEquals("application/json", recordedRequest.getHeader("Content-Type")); }
public Observable<String> getPokemonStringObservable(String id) { return pokemonService.getPokemon(id) .map(new Function<Pokemon, String>() { @Override public String apply(@NonNull Pokemon pokemon) throws Exception { return constructPokemon(pokemon); } }); }
PokeDataSource { public Observable<String> getPokemonStringObservable(String id) { return pokemonService.getPokemon(id) .map(new Function<Pokemon, String>() { @Override public String apply(@NonNull Pokemon pokemon) throws Exception { return constructPokemon(pokemon); } }); } }
PokeDataSource { public Observable<String> getPokemonStringObservable(String id) { return pokemonService.getPokemon(id) .map(new Function<Pokemon, String>() { @Override public String apply(@NonNull Pokemon pokemon) throws Exception { return constructPokemon(pokemon); } }); } @Inject  PokeDataSource(PokemonService pokemonService); }
PokeDataSource { public Observable<String> getPokemonStringObservable(String id) { return pokemonService.getPokemon(id) .map(new Function<Pokemon, String>() { @Override public String apply(@NonNull Pokemon pokemon) throws Exception { return constructPokemon(pokemon); } }); } @Inject  PokeDataSource(PokemonService pokemonService); Observable<String> getPokemonStringObservable(String id); Observable<String> getPokemonAbilityStringObservable(String id); }
PokeDataSource { public Observable<String> getPokemonStringObservable(String id) { return pokemonService.getPokemon(id) .map(new Function<Pokemon, String>() { @Override public String apply(@NonNull Pokemon pokemon) throws Exception { return constructPokemon(pokemon); } }); } @Inject  PokeDataSource(PokemonService pokemonService); Observable<String> getPokemonStringObservable(String id); Observable<String> getPokemonAbilityStringObservable(String id);  }