@Test public void getSounds_emitsNone_whenSearchResultsIsNone() { new Arrangement().enqueueSearchResults(Option.none()); viewModel.getSoundsOnceAndStream() .test() .assertValue(isNone()); }
@NonNull Observable<Option<List<DisplayableItem<Sound>>>> getSoundsOnceAndStream() { return searchDataModel.getSearchStateOnceAndStream() .map(SearchState::results) .map(it -> it.map(SearchFragmentViewModel::wrapInDisplayableItem)) .doOnNext(__ -> audioPlayer.stopPlayback()); }
SearchFragmentViewModel extends SimpleViewModel { @NonNull Observable<Option<List<DisplayableItem<Sound>>>> getSoundsOnceAndStream() { return searchDataModel.getSearchStateOnceAndStream() .map(SearchState::results) .map(it -> it.map(SearchFragmentViewModel::wrapInDisplayableItem)) .doOnNext(__ -> audioPlayer.stopPlayback()); } }
SearchFragmentViewModel extends SimpleViewModel { @NonNull Observable<Option<List<DisplayableItem<Sound>>>> getSoundsOnceAndStream() { return searchDataModel.getSearchStateOnceAndStream() .map(SearchState::results) .map(it -> it.map(SearchFragmentViewModel::wrapInDisplayableItem)) .doOnNext(__ -> audioPlayer.stopPlayback()); } SearchFragmentViewModel(@NonNull final SearchDataModel searchDataModel,
                            @NonNull final Navigator navigator,
                            @NonNull final AudioPlayer audioPlayer); }
SearchFragmentViewModel extends SimpleViewModel { @NonNull Observable<Option<List<DisplayableItem<Sound>>>> getSoundsOnceAndStream() { return searchDataModel.getSearchStateOnceAndStream() .map(SearchState::results) .map(it -> it.map(SearchFragmentViewModel::wrapInDisplayableItem)) .doOnNext(__ -> audioPlayer.stopPlayback()); } SearchFragmentViewModel(@NonNull final SearchDataModel searchDataModel,
                            @NonNull final Navigator navigator,
                            @NonNull final AudioPlayer audioPlayer);  }
SearchFragmentViewModel extends SimpleViewModel { @NonNull Observable<Option<List<DisplayableItem<Sound>>>> getSoundsOnceAndStream() { return searchDataModel.getSearchStateOnceAndStream() .map(SearchState::results) .map(it -> it.map(SearchFragmentViewModel::wrapInDisplayableItem)) .doOnNext(__ -> audioPlayer.stopPlayback()); } SearchFragmentViewModel(@NonNull final SearchDataModel searchDataModel,
                            @NonNull final Navigator navigator,
                            @NonNull final AudioPlayer audioPlayer);   }