@Test public void testNormalWithNullItem() { AtomicReference<UniEmitter<? super String>> reference = new AtomicReference<>(); AbstractUni<? super String> uni = (AbstractUni<? super String>) Uni.createFrom().<String> emitter( reference::set); UniAssertSubscriber<Object> subscriber = UniAssertSubscriber.create(); UniSerializedSubscriber.subscribe(uni, subscriber); subscriber.assertSubscribed(); reference.get().complete(null); reference.get().complete("hello"); reference.get().fail(new IOException("boom")); subscriber .assertCompletedSuccessfully() .assertNoFailure() .assertItem(null); }
public static <T> void subscribe(AbstractUni<T> source, UniSubscriber<? super T> subscriber) { UniSubscriber<? super T> actual = Infrastructure.onUniSubscription(source, subscriber); UniSerializedSubscriber<T> wrapped = new UniSerializedSubscriber<>(source, actual); wrapped.subscribe(); }
UniSerializedSubscriber implements UniSubscriber<T>, UniSubscription { public static <T> void subscribe(AbstractUni<T> source, UniSubscriber<? super T> subscriber) { UniSubscriber<? super T> actual = Infrastructure.onUniSubscription(source, subscriber); UniSerializedSubscriber<T> wrapped = new UniSerializedSubscriber<>(source, actual); wrapped.subscribe(); } }
UniSerializedSubscriber implements UniSubscriber<T>, UniSubscription { public static <T> void subscribe(AbstractUni<T> source, UniSubscriber<? super T> subscriber) { UniSubscriber<? super T> actual = Infrastructure.onUniSubscription(source, subscriber); UniSerializedSubscriber<T> wrapped = new UniSerializedSubscriber<>(source, actual); wrapped.subscribe(); } UniSerializedSubscriber(AbstractUni<T> upstream, UniSubscriber<? super T> subscriber); }
UniSerializedSubscriber implements UniSubscriber<T>, UniSubscription { public static <T> void subscribe(AbstractUni<T> source, UniSubscriber<? super T> subscriber) { UniSubscriber<? super T> actual = Infrastructure.onUniSubscription(source, subscriber); UniSerializedSubscriber<T> wrapped = new UniSerializedSubscriber<>(source, actual); wrapped.subscribe(); } UniSerializedSubscriber(AbstractUni<T> upstream, UniSubscriber<? super T> subscriber); static void subscribe(AbstractUni<T> source, UniSubscriber<? super T> subscriber); @Override void onSubscribe(UniSubscription subscription); @Override void onItem(T item); @Override void onFailure(Throwable throwable); @Override void cancel(); synchronized boolean isCancelledOrDone(); }
UniSerializedSubscriber implements UniSubscriber<T>, UniSubscription { public static <T> void subscribe(AbstractUni<T> source, UniSubscriber<? super T> subscriber) { UniSubscriber<? super T> actual = Infrastructure.onUniSubscription(source, subscriber); UniSerializedSubscriber<T> wrapped = new UniSerializedSubscriber<>(source, actual); wrapped.subscribe(); } UniSerializedSubscriber(AbstractUni<T> upstream, UniSubscriber<? super T> subscriber); static void subscribe(AbstractUni<T> source, UniSubscriber<? super T> subscriber); @Override void onSubscribe(UniSubscription subscription); @Override void onItem(T item); @Override void onFailure(Throwable throwable); @Override void cancel(); synchronized boolean isCancelledOrDone();  }