use of reactor.core.publisher.FluxExpand.ExpandDepthSubscription in project reactor-core by reactor.
the class FluxExpandTest method currentContextForExpandDepthSubscriber.
@Test
public void currentContextForExpandDepthSubscriber() {
final Context context = Context.of("foo", "bar");
CoreSubscriber<Integer> parentActual = new BaseSubscriber<Integer>() {
@Override
public Context currentContext() {
return context;
}
};
ExpandDepthSubscription<Integer> expandDepthSubscription = new ExpandDepthSubscription<>(parentActual, i -> i > 5 ? Mono.empty() : Mono.just(i + 1), 123);
ExpandDepthSubscriber<Integer> test = new ExpandDepthSubscriber<>(expandDepthSubscription);
assertThat(test.currentContext()).isSameAs(context);
}
use of reactor.core.publisher.FluxExpand.ExpandDepthSubscription in project reactor-core by reactor.
the class FluxExpandTest method scanExpandDepthSubscriber.
@Test
public void scanExpandDepthSubscriber() {
CoreSubscriber<Integer> parentActual = new LambdaSubscriber<>(null, Throwable::printStackTrace, null, null);
ExpandDepthSubscription<Integer> eds = new ExpandDepthSubscription<>(parentActual, i -> i > 5 ? Mono.empty() : Mono.just(i + 1), 123);
ExpandDepthSubscriber<Integer> test = new ExpandDepthSubscriber<>(eds);
Subscription s = Operators.emptySubscription();
test.onSubscribe(s);
assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(s);
assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(parentActual);
assertThat(test.scan(Scannable.Attr.TERMINATED)).isFalse();
test.onComplete();
assertThat(test.scan(Scannable.Attr.TERMINATED)).isTrue();
}
Aggregations