@@ -0,0 +1,3237 @@
+package org.apache.taverna.mobile;%0A%0Aimport org.apache.taverna.mobile.data.DataManager;%0Aimport org.apache.taverna.mobile.data.model.Workflow;%0Aimport org.apache.taverna.mobile.data.model.Workflows;%0Aimport org.apache.taverna.mobile.ui.favouriteworkflow.FavouriteWorkflowsMvpView;%0Aimport org.apache.taverna.mobile.ui.favouriteworkflow.FavouriteWorkflowsPresenter;%0Aimport org.apache.taverna.mobile.utils.RxSchedulersOverrideRule;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport rx.Observable;%0A%0Aimport static org.mockito.Mockito.never;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0A%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class FavouriteWorkflowsPresenterTest %7B%0A%0A    @Rule%0A    public final RxSchedulersOverrideRule rxSchedulersOverrideRule = new%0A            RxSchedulersOverrideRule();%0A    @Mock%0A    DataManager dataManager;%0A%0A    @Mock%0A    FavouriteWorkflowsMvpView favouriteWorkflowsMvpView;%0A%0A    private Workflows workflows;%0A%0A    private FavouriteWorkflowsPresenter favouriteWorkflowsPresenter;%0A%0A    @Before%0A    public void setUp() %7B%0A%0A        favouriteWorkflowsPresenter = new FavouriteWorkflowsPresenter(dataManager);%0A        favouriteWorkflowsPresenter.attachView(favouriteWorkflowsMvpView);%0A        workflows = FakeRemoteDataSource.getWorkflowList();%0A    %7D%0A%0A    @After%0A    public void tearDown() %7B%0A%0A        favouriteWorkflowsPresenter.detachView();%0A    %7D%0A%0A    @Test%0A    public void loadAllWorkflow_validWorkflowList_ReturnsResults() %7B%0A%0A        when(dataManager.getFavoriteWorkflowList()).thenReturn%0A                (Observable.just(workflows.getWorkflowList()));%0A%0A        favouriteWorkflowsPresenter.loadAllWorkflow();%0A%0A        verify(favouriteWorkflowsMvpView).showWorkflows(workflows.getWorkflowList());%0A        verify(favouriteWorkflowsMvpView, never()).showEmptyWorkflow();%0A        verify(favouriteWorkflowsMvpView, never()).showErrorSnackBar();%0A%0A    %7D%0A%0A    @Test%0A    public void loadAllWorkflow_EmptyWorkflowList_ReturnsNoWorkflowResults() %7B%0A%0A        Workflows workflows = new Workflows();%0A        workflows.setWorkflowList(new ArrayList%3CWorkflow%3E());%0A%0A        when(dataManager.getFavoriteWorkflowList()).thenReturn%0A                (Observable.just(workflows.getWorkflowList()));%0A%0A        favouriteWorkflowsPresenter.loadAllWorkflow();%0A%0A        verify(favouriteWorkflowsMvpView, never()).showWorkflows(workflows.getWorkflowList());%0A        verify(favouriteWorkflowsMvpView).showEmptyWorkflow();%0A        verify(favouriteWorkflowsMvpView, never()).showErrorSnackBar();%0A%0A    %7D%0A%0A    @Test%0A    public void loadAllWorkflow_RuntimeError_ShowError() %7B%0A%0A        when(dataManager.getFavoriteWorkflowList()).thenReturn%0A                (Observable.%3CList%3CWorkflow%3E%3Eerror(new RuntimeException()));%0A%0A        favouriteWorkflowsPresenter.loadAllWorkflow();%0A%0A        verify(favouriteWorkflowsMvpView, never()).showWorkflows(workflows.getWorkflowList());%0A        verify(favouriteWorkflowsMvpView, never()).showEmptyWorkflow();%0A        verify(favouriteWorkflowsMvpView).showErrorSnackBar();%0A%0A    %7D%0A%0A%0A%7D%0A

add Favourite Workflow's Presenter Test