@SuppressWarnings("unchecked")
@Test
public void shouldCallOnError() throws Exception {

    Callable<Object> func = mock(Callable.class);
    Throwable throwable = new IllegalStateException("Test exception");
    when(func.call()).thenThrow(throwable);
    Observable<Object> fromCallableObservable = Observable.fromCallable(func);
    Observer<Object> observer = TestHelper.mockObserver();
    fromCallableObservable.subscribe(observer);
    verify(observer, never()).onNext(any());
    verify(observer, never()).onComplete();
    verify(observer).onError(throwable);
}