// Path: app/src/main/java/com/wiseass/profiler/data/photos/Photo.java
// public class Photo {
//    private String photoUri;
// 
//     public Photo(String photoUri) {
//         this.photoUri = photoUri;
//     }
// 
//     public String getPhotoUri() {
//         return photoUri;
//     }
// 
//     public void setPhotoUri(String photoUri) {
//         this.photoUri = photoUri;
//     }
// }
// 
// Path: app/src/prod/java/com/wiseass/profiler/data/photos/PhotoInjection.java
// public class PhotoInjection {
// 
//     public static PhotoSource providePhotoSource() {
//         return PhotoService.getInstance();
//     }
// }
// 
// Path: app/src/main/java/com/wiseass/profiler/data/photos/PhotoSource.java
// public interface PhotoSource {
//     Maybe<List<Photo>> getThumbnails(ContentResolver resolver);
// 
//     void setReturnFail(boolean bool);
// }
// 
// Path: app/src/mock/java/com/wiseass/profiler/data/scheduler/SchedulerInjection.java
// public class SchedulerInjection {
// 
//     public static BaseSchedulerProvider provideSchedulerProvider(){
//         return ImmediateSchedulerProvider.getInstance();
//     }
// 
// }
// 
// Path: app/src/main/java/com/wiseass/profiler/photogallery/PhotoGalleryContract.java
// public interface PhotoGalleryContract {
// 
//     interface View extends BaseView<Presenter> {
//         void setAdapterData(List<Photo> photos);
// 
//         void setNoListDataFound();
// 
//         Activity getActivityContext();
// 
//         void makeToast(@StringRes int message);
// 
//         void setPresenter(Presenter presenter);
// 
//         void startPhotoDetailActivity(String photoURL);
// 
//         void showProgressIndicator(boolean show);
// 
//     }
// 
//     interface Presenter extends BasePresenter {
//         void onPhotoItemClick(int itemPosition);
//     }
// }
// 
// Path: app/src/main/java/com/wiseass/profiler/photogallery/PhotoGalleryPresenter.java
// public class PhotoGalleryPresenter implements PhotoGalleryContract.Presenter {
// 
//     private final BaseSchedulerProvider schedulerProvider;
//     private PhotoSource photoSource;
//     private PhotoGalleryContract.View view;
//     private List<Photo> photos;
//     private CompositeDisposable subscriptions;
//     private ContentResolver resolver;
// 
//     public PhotoGalleryPresenter(PhotoGalleryContract.View view,
//                                  PhotoSource photoSource,
//                                  BaseSchedulerProvider schedulerProvider,
//                                  ContentResolver resolver
//                                  ) {
//         this.photoSource = photoSource;
//         this.view = view;
//         this.schedulerProvider = schedulerProvider;
//         this.subscriptions = new CompositeDisposable();
//         this.resolver = resolver;
//         view.setPresenter(this);
// 
//     }
// 
//     @Override
//     public void onPhotoItemClick(int itemPosition) {
//         Photo photo = photos.get(itemPosition);
//         view.startPhotoDetailActivity(photo.getPhotoUri());
//     }
// 
//     private void loadImageURLsIfAvailable(){
//         view.showProgressIndicator(true);
//         subscriptions.add(photoSource.getThumbnails(resolver)
//                 .subscribeOn(schedulerProvider.io())
//                 .observeOn(schedulerProvider.ui())
//                 .subscribeWith(new DisposableMaybeObserver<List<Photo>>() {
//                     @Override
//                     public void onSuccess(List<Photo> photos) {
//                         view.showProgressIndicator(false);
//                         PhotoGalleryPresenter.this.photos = photos;
//                         view.setAdapterData(photos);
//                     }
// 
//                     @Override
//                     public void onError(Throwable e) {
//                         view.makeToast(e.getMessage());
//                     }
// 
//                     @Override
//                     public void onComplete() {
//                         view.setNoListDataFound();
//                     }
// 
//                 })
//         );
//     }
// 
//     @Override
//     public void subscribe() {
//         loadImageURLsIfAvailable();
//     }
// 
//     @Override
//     public void unsubscribe() {
//         subscriptions.clear();
//     }
// }


import android.content.ContentResolver;
import com.wiseass.profiler.data.photos.Photo;
import com.wiseass.profiler.data.photos.PhotoInjection;
import com.wiseass.profiler.data.photos.PhotoSource;
import com.wiseass.profiler.data.scheduler.SchedulerInjection;
import com.wiseass.profiler.photogallery.PhotoGalleryContract;
import com.wiseass.profiler.photogallery.PhotoGalleryPresenter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.ArrayList;
package com.wiseass.profiler;





/**
 * Responsible for Displaying a gallery of the user's device's images. When an Image is selected,
 * it forwards that image's URL to PhotoDetailActivity
 * Created by Ryan on 13/01/2017.
 */
@RunWith(MockitoJUnitRunner.class)
public class PhotoGalleryPresenterTest {

    @Mock
    private PhotoGalleryContract.View view;

    private PhotoSource photoSource;

    @Mock
    private ArrayList<Photo> photos;

    private PhotoGalleryPresenter presenter;

    @Mock
    ContentResolver resolver;

    public PhotoGalleryPresenterTest() {

    }

    @Before
    public void setUp() throws Exception {
        //Automatically Mocks fields with @Mock annotation
        MockitoAnnotations.initMocks(this);
// Path: app/src/main/java/com/wiseass/profiler/data/photos/Photo.java
// public class Photo {
//    private String photoUri;
// 
//     public Photo(String photoUri) {
//         this.photoUri = photoUri;
//     }
// 
//     public String getPhotoUri() {
//         return photoUri;
//     }
// 
//     public void setPhotoUri(String photoUri) {
//         this.photoUri = photoUri;
//     }
// }
// 
// Path: app/src/prod/java/com/wiseass/profiler/data/photos/PhotoInjection.java
// public class PhotoInjection {
// 
//     public static PhotoSource providePhotoSource() {
//         return PhotoService.getInstance();
//     }
// }
// 
// Path: app/src/main/java/com/wiseass/profiler/data/photos/PhotoSource.java
// public interface PhotoSource {
//     Maybe<List<Photo>> getThumbnails(ContentResolver resolver);
// 
//     void setReturnFail(boolean bool);
// }
// 
// Path: app/src/mock/java/com/wiseass/profiler/data/scheduler/SchedulerInjection.java
// public class SchedulerInjection {
// 
//     public static BaseSchedulerProvider provideSchedulerProvider(){
//         return ImmediateSchedulerProvider.getInstance();
//     }
// 
// }
// 
// Path: app/src/main/java/com/wiseass/profiler/photogallery/PhotoGalleryContract.java
// public interface PhotoGalleryContract {
// 
//     interface View extends BaseView<Presenter> {
//         void setAdapterData(List<Photo> photos);
// 
//         void setNoListDataFound();
// 
//         Activity getActivityContext();
// 
//         void makeToast(@StringRes int message);
// 
//         void setPresenter(Presenter presenter);
// 
//         void startPhotoDetailActivity(String photoURL);
// 
//         void showProgressIndicator(boolean show);
// 
//     }
// 
//     interface Presenter extends BasePresenter {
//         void onPhotoItemClick(int itemPosition);
//     }
// }
// 
// Path: app/src/main/java/com/wiseass/profiler/photogallery/PhotoGalleryPresenter.java
// public class PhotoGalleryPresenter implements PhotoGalleryContract.Presenter {
// 
//     private final BaseSchedulerProvider schedulerProvider;
//     private PhotoSource photoSource;
//     private PhotoGalleryContract.View view;
//     private List<Photo> photos;
//     private CompositeDisposable subscriptions;
//     private ContentResolver resolver;
// 
//     public PhotoGalleryPresenter(PhotoGalleryContract.View view,
//                                  PhotoSource photoSource,
//                                  BaseSchedulerProvider schedulerProvider,
//                                  ContentResolver resolver
//                                  ) {
//         this.photoSource = photoSource;
//         this.view = view;
//         this.schedulerProvider = schedulerProvider;
//         this.subscriptions = new CompositeDisposable();
//         this.resolver = resolver;
//         view.setPresenter(this);
// 
//     }
// 
//     @Override
//     public void onPhotoItemClick(int itemPosition) {
//         Photo photo = photos.get(itemPosition);
//         view.startPhotoDetailActivity(photo.getPhotoUri());
//     }
// 
//     private void loadImageURLsIfAvailable(){
//         view.showProgressIndicator(true);
//         subscriptions.add(photoSource.getThumbnails(resolver)
//                 .subscribeOn(schedulerProvider.io())
//                 .observeOn(schedulerProvider.ui())
//                 .subscribeWith(new DisposableMaybeObserver<List<Photo>>() {
//                     @Override
//                     public void onSuccess(List<Photo> photos) {
//                         view.showProgressIndicator(false);
//                         PhotoGalleryPresenter.this.photos = photos;
//                         view.setAdapterData(photos);
//                     }
// 
//                     @Override
//                     public void onError(Throwable e) {
//                         view.makeToast(e.getMessage());
//                     }
// 
//                     @Override
//                     public void onComplete() {
//                         view.setNoListDataFound();
//                     }
// 
//                 })
//         );
//     }
// 
//     @Override
//     public void subscribe() {
//         loadImageURLsIfAvailable();
//     }
// 
//     @Override
//     public void unsubscribe() {
//         subscriptions.clear();
//     }
// }


// Path: app/src/test/java/com/wiseass/profiler/PhotoGalleryPresenterTest.java
import android.content.ContentResolver;
import com.wiseass.profiler.data.photos.Photo;
import com.wiseass.profiler.data.photos.PhotoInjection;
import com.wiseass.profiler.data.photos.PhotoSource;
import com.wiseass.profiler.data.scheduler.SchedulerInjection;
import com.wiseass.profiler.photogallery.PhotoGalleryContract;
import com.wiseass.profiler.photogallery.PhotoGalleryPresenter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.ArrayList;

package com.wiseass.profiler;





/**
 * Responsible for Displaying a gallery of the user's device's images. When an Image is selected,
 * it forwards that image's URL to PhotoDetailActivity
 * Created by Ryan on 13/01/2017.
 */
@RunWith(MockitoJUnitRunner.class)
public class PhotoGalleryPresenterTest {

    @Mock
    private PhotoGalleryContract.View view;

    private PhotoSource photoSource;

    @Mock
    private ArrayList<Photo> photos;

    private PhotoGalleryPresenter presenter;

    @Mock
    ContentResolver resolver;

    public PhotoGalleryPresenterTest() {

    }

    @Before
    public void setUp() throws Exception {
        //Automatically Mocks fields with @Mock annotation
        MockitoAnnotations.initMocks(this);
        photoSource = PhotoInjection.providePhotoSource();