use of io.reactivex.rxjava3.internal.subscriptions.ScalarSubscription in project RxJava by ReactiveX.
the class RxJavaPluginsTest method overrideConnectableFlowable.
@SuppressWarnings("rawtypes")
@Test
public void overrideConnectableFlowable() {
try {
RxJavaPlugins.setOnConnectableFlowableAssembly(new Function<ConnectableFlowable, ConnectableFlowable>() {
@Override
public ConnectableFlowable apply(ConnectableFlowable co) throws Exception {
return new ConnectableFlowable() {
@Override
public void connect(Consumer connection) {
}
@Override
public void reset() {
// nothing to do in this test
}
@SuppressWarnings("unchecked")
@Override
protected void subscribeActual(Subscriber subscriber) {
subscriber.onSubscribe(new ScalarSubscription(subscriber, 10));
}
};
}
});
Flowable.just(1).publish().autoConnect().test().assertResult(10);
} finally {
RxJavaPlugins.reset();
}
Flowable.just(1).publish().autoConnect().test().assertResult(1);
}
Aggregations