@Test
public void getTask_requestsSingleTaskFromLocalDataSource() {

    // Given a stub completed task with title and description in the local repository
    Task task = new Task(TASK_TITLE, "Some Task Description", true);
    Optional<Task> taskOptional = Optional.of(task);
    setTaskAvailable(mTasksLocalDataSource, taskOptional);
    // And the task not available in the remote repository
    setTaskNotAvailable(mTasksRemoteDataSource, taskOptional.get().getId());
    // When a task is requested from the tasks repository
    TestSubscriber<Optional<Task>> testSubscriber = new TestSubscriber<>();
    mTasksRepository.getTask(task.getId()).subscribe(testSubscriber);
    // Then the task is loaded from the database
    Mockito.verify(mTasksLocalDataSource).getTask(Matchers.eq(task.getId()));
    testSubscriber.assertValue(taskOptional);
}