@Test public void testRefreshError() throws Exception { final Throwable exception = new Throwable(); when(mockedDataProvider.fetchNewest()).thenReturn(Single.error(exception)); tested.onRefresh(); verify(mockedView).hideRefreshing(); }
void onRefresh() { disposeDisposable(); disposable = map(dataProvider.fetchNewest()) .map(includeLoading()) .subscribe( new Consumer<List<?>>() { @Override public void accept(List<?> items) throws Exception { collectionView.hideRefreshing(); collectionView.setItems(items); } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { throwable.printStackTrace(); collectionView.hideRefreshing(); } }); }
CollectionViewPresenter { void onRefresh() { disposeDisposable(); disposable = map(dataProvider.fetchNewest()) .map(includeLoading()) .subscribe( new Consumer<List<?>>() { @Override public void accept(List<?> items) throws Exception { collectionView.hideRefreshing(); collectionView.setItems(items); } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { throwable.printStackTrace(); collectionView.hideRefreshing(); } }); } }
CollectionViewPresenter { void onRefresh() { disposeDisposable(); disposable = map(dataProvider.fetchNewest()) .map(includeLoading()) .subscribe( new Consumer<List<?>>() { @Override public void accept(List<?> items) throws Exception { collectionView.hideRefreshing(); collectionView.setItems(items); } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { throwable.printStackTrace(); collectionView.hideRefreshing(); } }); } CollectionViewPresenter(@NonNull DataProvider<?> dataProvider); }
CollectionViewPresenter { void onRefresh() { disposeDisposable(); disposable = map(dataProvider.fetchNewest()) .map(includeLoading()) .subscribe( new Consumer<List<?>>() { @Override public void accept(List<?> items) throws Exception { collectionView.hideRefreshing(); collectionView.setItems(items); } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { throwable.printStackTrace(); collectionView.hideRefreshing(); } }); } CollectionViewPresenter(@NonNull DataProvider<?> dataProvider);  }
CollectionViewPresenter { void onRefresh() { disposeDisposable(); disposable = map(dataProvider.fetchNewest()) .map(includeLoading()) .subscribe( new Consumer<List<?>>() { @Override public void accept(List<?> items) throws Exception { collectionView.hideRefreshing(); collectionView.setItems(items); } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { throwable.printStackTrace(); collectionView.hideRefreshing(); } }); } CollectionViewPresenter(@NonNull DataProvider<?> dataProvider);   }