@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));
}
TasksPresenterTest.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:GitHub
作者:
评论列表
文章目录