Search in sources :

Example 1 with ImmediateSchedulerProvider

use of com.example.android.architecture.blueprints.todoapp.util.schedulers.ImmediateSchedulerProvider in project todo-mvp-rxjava by albertizzy.

the class StatisticsPresenterTest method setupStatisticsPresenter.

@Before
public void setupStatisticsPresenter() {
    // Mockito has a very convenient way to inject mocks by using the @Mock annotation. To
    // inject the mocks in the test the initMocks method needs to be called.
    MockitoAnnotations.initMocks(this);
    // Make the sure that all schedulers are immediate.
    mSchedulerProvider = new ImmediateSchedulerProvider();
    // Get a reference to the class under test
    mStatisticsPresenter = new StatisticsPresenter(mTasksRepository, mStatisticsView, mSchedulerProvider);
    // The presenter won't update the view unless it's active.
    when(mStatisticsView.isActive()).thenReturn(true);
    // We subscribe the tasks to 3, with one active and two completed
    TASKS = Lists.newArrayList(new Task("Title1", "Description1"), new Task("Title2", "Description2", true), new Task("Title3", "Description3", true));
}
Also used : Task(com.example.android.architecture.blueprints.todoapp.data.Task) ImmediateSchedulerProvider(com.example.android.architecture.blueprints.todoapp.util.schedulers.ImmediateSchedulerProvider) Before(org.junit.Before)

Example 2 with ImmediateSchedulerProvider

use of com.example.android.architecture.blueprints.todoapp.util.schedulers.ImmediateSchedulerProvider in project todo-mvp-rxjava by albertizzy.

the class TasksLocalDataSourceTest method setup.

@Before
public void setup() {
    TasksLocalDataSource.destroyInstance();
    mSchedulerProvider = new ImmediateSchedulerProvider();
    mLocalDataSource = TasksLocalDataSource.getInstance(InstrumentationRegistry.getTargetContext(), mSchedulerProvider);
}
Also used : ImmediateSchedulerProvider(com.example.android.architecture.blueprints.todoapp.util.schedulers.ImmediateSchedulerProvider) Before(org.junit.Before)

Example 3 with ImmediateSchedulerProvider

use of com.example.android.architecture.blueprints.todoapp.util.schedulers.ImmediateSchedulerProvider in project todo-mvp-rxjava by albertizzy.

the class AddEditTaskPresenterTest method setupMocksAndView.

@Before
public void setupMocksAndView() {
    // Mockito has a very convenient way to inject mocks by using the @Mock annotation. To
    // inject the mocks in the test the initMocks method needs to be called.
    MockitoAnnotations.initMocks(this);
    mSchedulerProvider = new ImmediateSchedulerProvider();
    // The presenter wont't update the view unless it's active.
    when(mAddEditTaskView.isActive()).thenReturn(true);
}
Also used : ImmediateSchedulerProvider(com.example.android.architecture.blueprints.todoapp.util.schedulers.ImmediateSchedulerProvider) Before(org.junit.Before)

Example 4 with ImmediateSchedulerProvider

use of com.example.android.architecture.blueprints.todoapp.util.schedulers.ImmediateSchedulerProvider in project todo-mvp-rxjava by albertizzy.

the class TaskDetailPresenterTest method setup.

@Before
public void setup() {
    // Mockito has a very convenient way to inject mocks by using the @Mock annotation. To
    // inject the mocks in the test the initMocks method needs to be called.
    MockitoAnnotations.initMocks(this);
    // Make the sure that all schedulers are immediate.
    mSchedulerProvider = new ImmediateSchedulerProvider();
    // The presenter won't update the view unless it's active.
    when(mTaskDetailView.isActive()).thenReturn(true);
}
Also used : ImmediateSchedulerProvider(com.example.android.architecture.blueprints.todoapp.util.schedulers.ImmediateSchedulerProvider) Before(org.junit.Before)

Example 5 with ImmediateSchedulerProvider

use of com.example.android.architecture.blueprints.todoapp.util.schedulers.ImmediateSchedulerProvider in project todo-mvp-rxjava by albertizzy.

the class TasksPresenterTest method setupTasksPresenter.

@Before
public void setupTasksPresenter() {
    // Mockito has a very convenient way to inject mocks by using the @Mock annotation. To
    // inject the mocks in the test the initMocks method needs to be called.
    MockitoAnnotations.initMocks(this);
    // Make the sure that all schedulers are immediate.
    mSchedulerProvider = new ImmediateSchedulerProvider();
    // Get a reference to the class under test
    mTasksPresenter = new TasksPresenter(mTasksRepository, mTasksView, mSchedulerProvider);
    // The presenter won't update the view unless it's active.
    when(mTasksView.isActive()).thenReturn(true);
    // We subscribe the tasks to 3, with one active and two completed
    TASKS = Lists.newArrayList(new Task("Title1", "Description1"), new Task("Title2", "Description2", true), new Task("Title3", "Description3", true));
}
Also used : Task(com.example.android.architecture.blueprints.todoapp.data.Task) ImmediateSchedulerProvider(com.example.android.architecture.blueprints.todoapp.util.schedulers.ImmediateSchedulerProvider) Before(org.junit.Before)

Aggregations

ImmediateSchedulerProvider (com.example.android.architecture.blueprints.todoapp.util.schedulers.ImmediateSchedulerProvider)5 Before (org.junit.Before)5 Task (com.example.android.architecture.blueprints.todoapp.data.Task)2