@Test public void loadPhoto_shouldDisplayMissingPhoto() { presenter.loadPhoto(); verify(view, times(1)).showMissingPhoto(); }
@Override public void loadPhoto() { if (photoId == -1) { view.showMissingPhoto(); return; } photoRepository.getPhoto(photoId, new PhotoDataSource.LoadPhotoCallback() { @Override public void onPhotoLoaded(Photo photo) { if (view != null && view.isActive()) { view.showPhoto(photo); } } @Override public void onPhotoNotAvailable() { if (view != null && view.isActive()) { view.showErrorDisplayingPhoto(); } } }); }
PhotoDetailPresenter implements PhotoDetailContract.Presenter { @Override public void loadPhoto() { if (photoId == -1) { view.showMissingPhoto(); return; } photoRepository.getPhoto(photoId, new PhotoDataSource.LoadPhotoCallback() { @Override public void onPhotoLoaded(Photo photo) { if (view != null && view.isActive()) { view.showPhoto(photo); } } @Override public void onPhotoNotAvailable() { if (view != null && view.isActive()) { view.showErrorDisplayingPhoto(); } } }); } }
PhotoDetailPresenter implements PhotoDetailContract.Presenter { @Override public void loadPhoto() { if (photoId == -1) { view.showMissingPhoto(); return; } photoRepository.getPhoto(photoId, new PhotoDataSource.LoadPhotoCallback() { @Override public void onPhotoLoaded(Photo photo) { if (view != null && view.isActive()) { view.showPhoto(photo); } } @Override public void onPhotoNotAvailable() { if (view != null && view.isActive()) { view.showErrorDisplayingPhoto(); } } }); } PhotoDetailPresenter(PhotoDetailContract.View view, PhotoRepository photoRepository); }
PhotoDetailPresenter implements PhotoDetailContract.Presenter { @Override public void loadPhoto() { if (photoId == -1) { view.showMissingPhoto(); return; } photoRepository.getPhoto(photoId, new PhotoDataSource.LoadPhotoCallback() { @Override public void onPhotoLoaded(Photo photo) { if (view != null && view.isActive()) { view.showPhoto(photo); } } @Override public void onPhotoNotAvailable() { if (view != null && view.isActive()) { view.showErrorDisplayingPhoto(); } } }); } PhotoDetailPresenter(PhotoDetailContract.View view, PhotoRepository photoRepository); @Override void loadPhoto(); @Override void setPhotoId(int photoId); @Override void dropView(); }
PhotoDetailPresenter implements PhotoDetailContract.Presenter { @Override public void loadPhoto() { if (photoId == -1) { view.showMissingPhoto(); return; } photoRepository.getPhoto(photoId, new PhotoDataSource.LoadPhotoCallback() { @Override public void onPhotoLoaded(Photo photo) { if (view != null && view.isActive()) { view.showPhoto(photo); } } @Override public void onPhotoNotAvailable() { if (view != null && view.isActive()) { view.showErrorDisplayingPhoto(); } } }); } PhotoDetailPresenter(PhotoDetailContract.View view, PhotoRepository photoRepository); @Override void loadPhoto(); @Override void setPhotoId(int photoId); @Override void dropView();  }