TodoListViewModelImpl extends BaseViewModel implements TodoListViewModel { @Override @SuppressWarnings("Anonymous2MethodRef") public Observable fetchAllTodo() { return configWithScheduler(mRepository.getAll()).doOnNext(items -> { mTodoItems.clear(); mTodoItems.addAll(TransformUtils.map(items, new TransformUtils.Map<Todo>() { @Override public TodoItemViewModel map(Todo todo) { return new TodoItemViewModel(todo); } })); checkEmptyAndShowAlert(); }); } TodoListViewModelImpl(@NonNull Context mContext, @NonNull TodoRepository todoRepository,
                                 @NonNull RxUtils.SchedulerHolder schedulerHolder); @Override ObservableInt getAlertVisibility(); @Override ObservableList<TodoItemViewModel> getTodoItems(); @Override @SuppressWarnings("Anonymous2MethodRef") Observable fetchAllTodo(); @Override Observable<Todo> checkChangeItem(TodoItemViewModel todoItemViewModel); @Override void insert(Todo todo); @Override void update(Todo todo); @Override Observable<Boolean> deleteItem(int position);  }
@Test public void testFetchAllTodo() throws Exception { fetchData(); assertThat(mItemViewModelList).hasSize(3); for (int i = 0; i < 3; i++) { assertEquals(Long.valueOf(i), mItemViewModelList.get(i).getTodo().getId()); } }