@Test public void loadVocabularyWordsNoTranslations() { addVocabularyData(makeWord(WORD, TRANSLATION)); addTranslation(WORD, null); TestObserver<List<VocabularyWord>> observer = new TestObserver<>(); module.loadVocabularyWords().enqueue(observer); VocabularyWord word = observer.getOnNextEvents().get(0).get(0); assertThat(word.getTranslations(), equalTo(Collections.emptyList())); }
@Override public Call<List<VocabularyWord>> loadVocabularyWords() { logger.debug("loadVocabularyWords()"); return new Call<List<VocabularyWord>>() { @Override public void enqueue(Action<List<VocabularyWord>> onData, Action<Throwable> onError) { mainExecutor.execute(new GetCachedDataTask(Observers.from(onData, onError))); mainExecutor.execute(new LoadWordsTask(Observers.from(onData, onError))); } @Override public void cancel() { } }; }
RestVocabularyModule implements VocabularyModule { @Override public Call<List<VocabularyWord>> loadVocabularyWords() { logger.debug("loadVocabularyWords()"); return new Call<List<VocabularyWord>>() { @Override public void enqueue(Action<List<VocabularyWord>> onData, Action<Throwable> onError) { mainExecutor.execute(new GetCachedDataTask(Observers.from(onData, onError))); mainExecutor.execute(new LoadWordsTask(Observers.from(onData, onError))); } @Override public void cancel() { } }; } }
RestVocabularyModule implements VocabularyModule { @Override public Call<List<VocabularyWord>> loadVocabularyWords() { logger.debug("loadVocabularyWords()"); return new Call<List<VocabularyWord>>() { @Override public void enqueue(Action<List<VocabularyWord>> onData, Action<Throwable> onError) { mainExecutor.execute(new GetCachedDataTask(Observers.from(onData, onError))); mainExecutor.execute(new LoadWordsTask(Observers.from(onData, onError))); } @Override public void cancel() { } }; } @Inject  RestVocabularyModule(RestService service, TranslationService translationService, AccountModule accountModule,
                                VocabularyWordsRepository provider, @Named(MAIN_EXECUTOR) Executor mainExecutor); }
RestVocabularyModule implements VocabularyModule { @Override public Call<List<VocabularyWord>> loadVocabularyWords() { logger.debug("loadVocabularyWords()"); return new Call<List<VocabularyWord>>() { @Override public void enqueue(Action<List<VocabularyWord>> onData, Action<Throwable> onError) { mainExecutor.execute(new GetCachedDataTask(Observers.from(onData, onError))); mainExecutor.execute(new LoadWordsTask(Observers.from(onData, onError))); } @Override public void cancel() { } }; } @Inject  RestVocabularyModule(RestService service, TranslationService translationService, AccountModule accountModule,
                                VocabularyWordsRepository provider, @Named(MAIN_EXECUTOR) Executor mainExecutor); @Override Call<List<VocabularyWord>> loadVocabularyWords(); @Override Call<List<VocabularyWord>> refreshVocabularyWords(); }
RestVocabularyModule implements VocabularyModule { @Override public Call<List<VocabularyWord>> loadVocabularyWords() { logger.debug("loadVocabularyWords()"); return new Call<List<VocabularyWord>>() { @Override public void enqueue(Action<List<VocabularyWord>> onData, Action<Throwable> onError) { mainExecutor.execute(new GetCachedDataTask(Observers.from(onData, onError))); mainExecutor.execute(new LoadWordsTask(Observers.from(onData, onError))); } @Override public void cancel() { } }; } @Inject  RestVocabularyModule(RestService service, TranslationService translationService, AccountModule accountModule,
                                VocabularyWordsRepository provider, @Named(MAIN_EXECUTOR) Executor mainExecutor); @Override Call<List<VocabularyWord>> loadVocabularyWords(); @Override Call<List<VocabularyWord>> refreshVocabularyWords(); static final String MAIN_EXECUTOR; }