@Test public void onNext() throws Exception { fs.onNext(1); fs.onComplete(); assertEquals(1, fs.get(5, TimeUnit.MILLISECONDS).intValue()); }
@Override public void onNext(T t) { if (value != null) { s.get().cancel(); onError(new IndexOutOfBoundsException("More than one element received")); return; } value = t; }
FutureSubscriber extends CountDownLatch implements FlowableSubscriber<T>, Future<T>, Subscription { @Override public void onNext(T t) { if (value != null) { s.get().cancel(); onError(new IndexOutOfBoundsException("More than one element received")); return; } value = t; } }
FutureSubscriber extends CountDownLatch implements FlowableSubscriber<T>, Future<T>, Subscription { @Override public void onNext(T t) { if (value != null) { s.get().cancel(); onError(new IndexOutOfBoundsException("More than one element received")); return; } value = t; } FutureSubscriber(); }
FutureSubscriber extends CountDownLatch implements FlowableSubscriber<T>, Future<T>, Subscription { @Override public void onNext(T t) { if (value != null) { s.get().cancel(); onError(new IndexOutOfBoundsException("More than one element received")); return; } value = t; } FutureSubscriber(); @Override boolean cancel(boolean mayInterruptIfRunning); @Override boolean isCancelled(); @Override boolean isDone(); @Override T get(); @Override T get(long timeout, TimeUnit unit); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override void cancel(); @Override void request(long n); }
FutureSubscriber extends CountDownLatch implements FlowableSubscriber<T>, Future<T>, Subscription { @Override public void onNext(T t) { if (value != null) { s.get().cancel(); onError(new IndexOutOfBoundsException("More than one element received")); return; } value = t; } FutureSubscriber(); @Override boolean cancel(boolean mayInterruptIfRunning); @Override boolean isCancelled(); @Override boolean isDone(); @Override T get(); @Override T get(long timeout, TimeUnit unit); @Override void onSubscribe(Subscription s); @Override void onNext(T t); @Override void onError(Throwable t); @Override void onComplete(); @Override void cancel(); @Override void request(long n);  }