@Test public void loadAllPhotosFromRepository_shouldDisplayFail() { presenter.loadPhotos(); verify(repository, times(1)).getPhotos(loadPhotosCallbackCaptor.capture()); loadPhotosCallbackCaptor.getValue().onPhotosNotAvailable(); final InOrder inOrder = Mockito.inOrder(view); inOrder.verify(view).setLoadingVisibility(true); inOrder.verify(view).setLoadingVisibility(false); inOrder.verify(view).showLoadingPhotosError(); }
@Override public void loadPhotos() { view.setLoadingVisibility(true); photoRepository.getPhotos(new PhotoDataSource.LoadPhotosCallback() { @Override public void onPhotosLoaded(List<Photo> photos) { if (view != null && view.isActive()) { view.setLoadingVisibility(false); view.showPhotos(photos); } } @Override public void onPhotosNotAvailable() { if (view != null && view.isActive()) { view.setLoadingVisibility(false); view.showLoadingPhotosError(); } } }); }
PhotoListPresenter implements PhotoListContract.Presenter { @Override public void loadPhotos() { view.setLoadingVisibility(true); photoRepository.getPhotos(new PhotoDataSource.LoadPhotosCallback() { @Override public void onPhotosLoaded(List<Photo> photos) { if (view != null && view.isActive()) { view.setLoadingVisibility(false); view.showPhotos(photos); } } @Override public void onPhotosNotAvailable() { if (view != null && view.isActive()) { view.setLoadingVisibility(false); view.showLoadingPhotosError(); } } }); } }
PhotoListPresenter implements PhotoListContract.Presenter { @Override public void loadPhotos() { view.setLoadingVisibility(true); photoRepository.getPhotos(new PhotoDataSource.LoadPhotosCallback() { @Override public void onPhotosLoaded(List<Photo> photos) { if (view != null && view.isActive()) { view.setLoadingVisibility(false); view.showPhotos(photos); } } @Override public void onPhotosNotAvailable() { if (view != null && view.isActive()) { view.setLoadingVisibility(false); view.showLoadingPhotosError(); } } }); } PhotoListPresenter(PhotoListContract.View view, PhotoRepository photoRepository); }
PhotoListPresenter implements PhotoListContract.Presenter { @Override public void loadPhotos() { view.setLoadingVisibility(true); photoRepository.getPhotos(new PhotoDataSource.LoadPhotosCallback() { @Override public void onPhotosLoaded(List<Photo> photos) { if (view != null && view.isActive()) { view.setLoadingVisibility(false); view.showPhotos(photos); } } @Override public void onPhotosNotAvailable() { if (view != null && view.isActive()) { view.setLoadingVisibility(false); view.showLoadingPhotosError(); } } }); } PhotoListPresenter(PhotoListContract.View view, PhotoRepository photoRepository); @Override void loadPhotos(); @Override void onPhotoSelected(Photo selectedPhoto); @Override void onRefresh(); @Override void dropView(); }
PhotoListPresenter implements PhotoListContract.Presenter { @Override public void loadPhotos() { view.setLoadingVisibility(true); photoRepository.getPhotos(new PhotoDataSource.LoadPhotosCallback() { @Override public void onPhotosLoaded(List<Photo> photos) { if (view != null && view.isActive()) { view.setLoadingVisibility(false); view.showPhotos(photos); } } @Override public void onPhotosNotAvailable() { if (view != null && view.isActive()) { view.setLoadingVisibility(false); view.showLoadingPhotosError(); } } }); } PhotoListPresenter(PhotoListContract.View view, PhotoRepository photoRepository); @Override void loadPhotos(); @Override void onPhotoSelected(Photo selectedPhoto); @Override void onRefresh(); @Override void dropView();  }