@Test public void onCompleteWithoutOnSubscribe() { TestSubscriber<Integer> ts = new TestSubscriber<Integer>(); SafeSubscriber<Integer> so = new SafeSubscriber<Integer>(ts); so.onComplete(); ts.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); } }
SafeSubscriber implements FlowableSubscriber<T>, Subscription { @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); } } }
SafeSubscriber implements FlowableSubscriber<T>, Subscription { @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); } } SafeSubscriber(Subscriber<? super T> actual); }
SafeSubscriber implements FlowableSubscriber<T>, Subscription { @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); } } SafeSubscriber(Subscriber<? super T> actual); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override void request(long n); @Override void cancel(); }
SafeSubscriber implements FlowableSubscriber<T>, Subscription { @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); } } SafeSubscriber(Subscriber<? super T> actual); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override void request(long n); @Override void cancel();  }