@Test
public void testDeleteFail() throws Exception {

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