### Question:
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();  }### Answer:
@Test public void loadAllPhotosFromRepository_shouldDisplaySuccess() { presenter.loadPhotos(); verify(repository, times(1)).getPhotos(loadPhotosCallbackCaptor.capture()); loadPhotosCallbackCaptor.getValue().onPhotosLoaded(PHOTOS); final InOrder inOrder = Mockito.inOrder(view); inOrder.verify(view).setLoadingVisibility(true); inOrder.verify(view).setLoadingVisibility(false); verify(view, times(1)).showPhotos(photoListArgumentCaptor.capture()); final List<Photo> result = photoListArgumentCaptor.getValue(); assertThat(result, is(PHOTOS)); }
@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(); }