@Test public void onCompleteWithoutOnSubscribe() { TestObserver<Integer> to = new TestObserver<Integer>(); SafeObserver<Integer> so = new SafeObserver<Integer>(to); so.onComplete(); to.assertFailureAndMessage(NullPointerException.class, "Subscription not set!"); }
@Override public void onComplete() { if (done) { return; } done = true; if (s == null) { onCompleteNoSubscription(); return; } try { actual.onComplete(); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(e); } }
SafeObserver implements Observer<T>, Disposable { @Override public void onComplete() { if (done) { return; } done = true; if (s == null) { onCompleteNoSubscription(); return; } try { actual.onComplete(); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(e); } } }
SafeObserver implements Observer<T>, Disposable { @Override public void onComplete() { if (done) { return; } done = true; if (s == null) { onCompleteNoSubscription(); return; } try { actual.onComplete(); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(e); } } SafeObserver(@NonNull Observer<? super T> actual); }
SafeObserver implements Observer<T>, Disposable { @Override public void onComplete() { if (done) { return; } done = true; if (s == null) { onCompleteNoSubscription(); return; } try { actual.onComplete(); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(e); } } SafeObserver(@NonNull Observer<? super T> actual); @Override void onSubscribe(@NonNull Disposable s); @Override void dispose(); @Override boolean isDisposed(); @Override void onNext(@NonNull T t); @Override void onError(@NonNull Throwable t); @Override void onComplete(); }
SafeObserver implements Observer<T>, Disposable { @Override public void onComplete() { if (done) { return; } done = true; if (s == null) { onCompleteNoSubscription(); return; } try { actual.onComplete(); } catch (Throwable e) { Exceptions.throwIfFatal(e); RxJavaPlugins.onError(e); } } SafeObserver(@NonNull Observer<? super T> actual); @Override void onSubscribe(@NonNull Disposable s); @Override void dispose(); @Override boolean isDisposed(); @Override void onNext(@NonNull T t); @Override void onError(@NonNull Throwable t); @Override void onComplete();  }