FlowableScalarXMap { public static <T, U> Flowable<U> scalarXMap(final T value, final Function<? super T, ? extends Publisher<? extends U>> mapper) { return RxJavaPlugins.onAssembly(new ScalarXMapFlowable<T, U>(value, mapper)); } private  FlowableScalarXMap(); @SuppressWarnings("unchecked") static boolean tryScalarXMapSubscribe(Publisher<T> source,
            Subscriber<? super R> subscriber,
            Function<? super T, ? extends Publisher<? extends R>> mapper); static Flowable<U> scalarXMap(final T value, final Function<? super T, ? extends Publisher<? extends U>> mapper);  }
@Test public void scalarMapToEmpty() { FlowableScalarXMap.scalarXMap(1, new Function<Integer, Publisher<Integer>>() { @Override public Publisher<Integer> apply(Integer v) throws Exception { return Flowable.empty(); } }) .test() .assertResult(); }
@Test public void scalarMapToCrashingCallable() { FlowableScalarXMap.scalarXMap(1, new Function<Integer, Publisher<Integer>>() { @Override public Publisher<Integer> apply(Integer v) throws Exception { return new CallablePublisher(); } }) .test() .assertFailure(TestException.class); }