@Test
public void testCreateOrUpdateFail() throws Exception {

    Todo todo = Mockito.mock(Todo.class);
    when(todo.save()).thenReturn(-1L);
    mTodoRepository.createOrUpdate(todo).observeOn(Schedulers.immediate()).subscribe(newTodo -> {
        fail("Should throw exception");
    }, throwable -> {
        assertEquals("Can not save todo", throwable.getMessage());
    });
}