use of reactor.core.publisher.ParallelMergeReduce.MergeReduceInner in project reactor-core by reactor.
the class ParallelMergeReduceTest method scanInnerSubscriber.
@Test
public void scanInnerSubscriber() {
CoreSubscriber<? super Integer> subscriber = new LambdaSubscriber<>(null, e -> {
}, null, null);
MergeReduceMain<Integer> main = new MergeReduceMain<>(subscriber, 2, (a, b) -> a + b);
MergeReduceInner<Integer> test = new MergeReduceInner<>(main, (a, b) -> a + b);
Subscription s = Operators.emptySubscription();
test.onSubscribe(s);
assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(s);
assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(main);
assertThat(test.scan(Scannable.Attr.PREFETCH)).isEqualTo(Integer.MAX_VALUE);
assertThat(test.scan(Scannable.Attr.TERMINATED)).isFalse();
test.done = true;
assertThat(test.scan(Scannable.Attr.TERMINATED)).isTrue();
assertThat(test.scan(Scannable.Attr.BUFFERED)).isZero();
test.value = 3;
assertThat(test.scan(Scannable.Attr.BUFFERED)).isEqualTo(1);
assertThat(test.scan(Scannable.Attr.CANCELLED)).isFalse();
test.cancel();
assertThat(test.scan(Scannable.Attr.CANCELLED)).isTrue();
}
Aggregations