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
| @Mock MainView mainViewMock; | |
| @Mock PokeDataSource pokeDataSource; | |
| @Test | |
| public void testOnViewAdded() { | |
| reset(mainViewMock); | |
| MainPresenterImpl presenter = new MainPresenterImpl( | |
| schedulersProvider, pokeDataSource); |
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
| @Mock MainView mainViewMock; | |
| @Mock PokeDataSource pokeDataSource; | |
| @Mock HttpException httpException; | |
| @Test | |
| public void testDemoResponseError404() { | |
| reset(mainViewMock); | |
| MainPresenterImpl presenter = new MainPresenterImpl(schedulersProvider, pokeDataSource); |
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 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); | |
| } | |
| }); | |
| } |
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
| @Inject PokeService pokemonService; | |
| @Test | |
| public void testGetPokemonAbilityStringObservable() { | |
| PokeDataSource dataSource = new PokeDataSource(pokemonService); | |
| TestObserver observer = new TestObserver(); | |
| dataSource.getPokemonAbilityStringObservable("12") | |
| .subscribe(observer); | |
| observer.assertNoErrors(); |
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
| interface DataStore<T> { | |
| fun modelListObservable(): Maybe<List<T>> | |
| fun modelObservable(id: String): Maybe<T> | |
| fun putModels(vararg models: T) | |
| fun clear() |
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
| infix fun <T>Boolean.then(action : () -> T): T? { | |
| return if (this) | |
| action.invoke() | |
| else null | |
| } | |
| infix fun <T>T?.elze(action: () -> T): T { | |
| return if (this == null) | |
| action.invoke() |
OlderNewer