@Test public void fetchAllPlaces() { placesViewModel.fetchAllPlaces().subscribe(); placesViewModel.currentPlaces().subscribe(testSubscriberPlaces); testSubscriberPlaces.assertNoErrors(); List<List<Place>> lists = testSubscriberPlaces.getOnNextEvents(); assertEquals(lists.size(), 1); assertEquals(lists.get(0).size(), 10); }
@Override public Observable<Boolean> fetchAllPlaces() { return mPlacesApi.placesResult() .map(googleSearchResult -> { allPlaces = googleSearchResult.results; mPlaces.onNext(googleSearchResult.results); return true; }) .timeout(TIME_OUT, TimeUnit.SECONDS) .retry(RETRY); }
PlacesViewModel implements IPlacesViewModel { @Override public Observable<Boolean> fetchAllPlaces() { return mPlacesApi.placesResult() .map(googleSearchResult -> { allPlaces = googleSearchResult.results; mPlaces.onNext(googleSearchResult.results); return true; }) .timeout(TIME_OUT, TimeUnit.SECONDS) .retry(RETRY); } }
PlacesViewModel implements IPlacesViewModel { @Override public Observable<Boolean> fetchAllPlaces() { return mPlacesApi.placesResult() .map(googleSearchResult -> { allPlaces = googleSearchResult.results; mPlaces.onNext(googleSearchResult.results); return true; }) .timeout(TIME_OUT, TimeUnit.SECONDS) .retry(RETRY); } PlacesViewModel(@NonNull IPlacesApi placesApi); }
PlacesViewModel implements IPlacesViewModel { @Override public Observable<Boolean> fetchAllPlaces() { return mPlacesApi.placesResult() .map(googleSearchResult -> { allPlaces = googleSearchResult.results; mPlaces.onNext(googleSearchResult.results); return true; }) .timeout(TIME_OUT, TimeUnit.SECONDS) .retry(RETRY); } PlacesViewModel(@NonNull IPlacesApi placesApi); Observable<List<Place>> currentPlaces(); @Override Observable<Boolean> fetchAllPlaces(); @Override void filterPlacesByType(String type); }
PlacesViewModel implements IPlacesViewModel { @Override public Observable<Boolean> fetchAllPlaces() { return mPlacesApi.placesResult() .map(googleSearchResult -> { allPlaces = googleSearchResult.results; mPlaces.onNext(googleSearchResult.results); return true; }) .timeout(TIME_OUT, TimeUnit.SECONDS) .retry(RETRY); } PlacesViewModel(@NonNull IPlacesApi placesApi); Observable<List<Place>> currentPlaces(); @Override Observable<Boolean> fetchAllPlaces(); @Override void filterPlacesByType(String type);  }