// Path: app/src/test/java/com/txusballesteros/testing/UnitTest.java
// @RunWith(JUnit4.class)
// @SmallTest
// public abstract class UnitTest {
//     @Before
//     public final void setup() {
//         initializeMocks();
//         onSetup();
//     }
// 
//     private void initializeMocks() {
//         MockitoAnnotations.initMocks(this);
//     }
// 
//     protected abstract void onSetup();
// }
// 
// Path: app/src/main/java/com/txusballesteros/testing/domain/model/Image.java
// public class Image {
//     private Uri url;
// 
//     private Image() { }
// 
//     public Uri getUrl() {
//         return url;
//     }
// 
//     public static class Builder {
//         private Image image;
// 
//         public Builder() {
//             this.image = new Image();
//         }
// 
//         public Builder setUrl(Uri url) {
//             image.url = url;
//             return this;
//         }
// 
//         public Image build() {
//             return image;
//         }
//     }
// }
// 
// Path: app/src/main/java/com/txusballesteros/testing/domain/repository/DashboardRepository.java
// public interface DashboardRepository {
//     void getDashboard(final Callback callback);
// 
//     interface Callback {
//         void onSuccess(final List<Image> images);
//         void onError();
//     }
// }
// 
// Path: app/src/main/java/com/txusballesteros/testing/domain/usecase/GetDashboardUseCase.java
// public interface GetDashboardUseCase {
//     void execute(final Callback callback);
// 
//     interface Callback {
//         void onDashboardReady(List<Image> images);
//         void onError();
//     }
// }
// 
// Path: app/src/main/java/com/txusballesteros/testing/threading/PostExecutionThread.java
// public interface PostExecutionThread {
//     void post(Runnable runnable);
// }
// 
// Path: app/src/main/java/com/txusballesteros/testing/threading/ThreadExecutor.java
// public interface ThreadExecutor extends Executor { }


import org.junit.Test;
import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.util.List;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import com.txusballesteros.testing.UnitTest;
import com.txusballesteros.testing.domain.model.Image;
import com.txusballesteros.testing.domain.repository.DashboardRepository;
import com.txusballesteros.testing.domain.usecase.GetDashboardUseCase;
import com.txusballesteros.testing.threading.PostExecutionThread;
import com.txusballesteros.testing.threading.ThreadExecutor;

        verify(threadExecutorMock).execute(any(Runnable.class));
        verify(dashboardRepositoryMock).getDashboard(any(DashboardRepository.Callback.class));
        verifyNoMoreInteractions(dashboardRepositoryMock);
        verifyNoMoreInteractions(threadExecutorMock);
    }

    @Test
    public void shouldPostOnDashboardReady() {
        doAnswer(new Answer() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                ((DashboardRepository.Callback)invocation.getArguments()[0])
                                                    .onSuccess(repositoryResultMock);
                return null;
            }
        }).when(dashboardRepositoryMock).getDashboard(any(DashboardRepository.Callback.class));

        interactor.execute(callbackMock);

        verify(postExecutionThreadMock).post(any(Runnable.class));
        verify(callbackMock).onDashboardReady(eq(repositoryResultMock));
    }

    @Test
    public void shouldPostOnError() {
        doAnswer(new Answer() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                ((DashboardRepository.Callback)invocation.getArguments()[0]).onError();
// Path: app/src/test/java/com/txusballesteros/testing/UnitTest.java
// @RunWith(JUnit4.class)
// @SmallTest
// public abstract class UnitTest {
//     @Before
//     public final void setup() {
//         initializeMocks();
//         onSetup();
//     }
// 
//     private void initializeMocks() {
//         MockitoAnnotations.initMocks(this);
//     }
// 
//     protected abstract void onSetup();
// }
// 
// Path: app/src/main/java/com/txusballesteros/testing/domain/model/Image.java
// public class Image {
//     private Uri url;
// 
//     private Image() { }
// 
//     public Uri getUrl() {
//         return url;
//     }
// 
//     public static class Builder {
//         private Image image;
// 
//         public Builder() {
//             this.image = new Image();
//         }
// 
//         public Builder setUrl(Uri url) {
//             image.url = url;
//             return this;
//         }
// 
//         public Image build() {
//             return image;
//         }
//     }
// }
// 
// Path: app/src/main/java/com/txusballesteros/testing/domain/repository/DashboardRepository.java
// public interface DashboardRepository {
//     void getDashboard(final Callback callback);
// 
//     interface Callback {
//         void onSuccess(final List<Image> images);
//         void onError();
//     }
// }
// 
// Path: app/src/main/java/com/txusballesteros/testing/domain/usecase/GetDashboardUseCase.java
// public interface GetDashboardUseCase {
//     void execute(final Callback callback);
// 
//     interface Callback {
//         void onDashboardReady(List<Image> images);
//         void onError();
//     }
// }
// 
// Path: app/src/main/java/com/txusballesteros/testing/threading/PostExecutionThread.java
// public interface PostExecutionThread {
//     void post(Runnable runnable);
// }
// 
// Path: app/src/main/java/com/txusballesteros/testing/threading/ThreadExecutor.java
// public interface ThreadExecutor extends Executor { }


// Path: app/src/test/java/com/txusballesteros/testing/domain/interactor/GetDashboardInteractorUnitTest.java
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.util.List;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import com.txusballesteros.testing.UnitTest;
import com.txusballesteros.testing.domain.model.Image;
import com.txusballesteros.testing.domain.repository.DashboardRepository;
import com.txusballesteros.testing.domain.usecase.GetDashboardUseCase;
import com.txusballesteros.testing.threading.PostExecutionThread;
import com.txusballesteros.testing.threading.ThreadExecutor;


        verify(threadExecutorMock).execute(any(Runnable.class));
        verify(dashboardRepositoryMock).getDashboard(any(DashboardRepository.Callback.class));
        verifyNoMoreInteractions(dashboardRepositoryMock);
        verifyNoMoreInteractions(threadExecutorMock);
    }

    @Test
    public void shouldPostOnDashboardReady() {
        doAnswer(new Answer() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                ((DashboardRepository.Callback)invocation.getArguments()[0])
                                                    .onSuccess(repositoryResultMock);
                return null;
            }
        }).when(dashboardRepositoryMock).getDashboard(any(DashboardRepository.Callback.class));

        interactor.execute(callbackMock);

        verify(postExecutionThreadMock).post(any(Runnable.class));
        verify(callbackMock).onDashboardReady(eq(repositoryResultMock));
    }

    @Test
    public void shouldPostOnError() {
        doAnswer(new Answer() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                ((DashboardRepository.Callback)invocation.getArguments()[0]).onError();
                return null;