use of reactor.core.publisher.ParallelCollect.ParallelCollectSubscriber in project reactor-core by reactor.
the class ParallelCollectTest method scanSubscriber.
@Test
public void scanSubscriber() {
CoreSubscriber<List<Integer>> subscriber = new LambdaSubscriber<>(null, e -> {
}, null, null);
ParallelCollectSubscriber<Integer, List<Integer>> test = new ParallelCollectSubscriber<>(subscriber, new ArrayList<>(), List::add);
Subscription s = Operators.emptySubscription();
test.onSubscribe(s);
assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(subscriber);
assertThat(test.scan(Scannable.Attr.PREFETCH)).isEqualTo(Integer.MAX_VALUE);
assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC);
assertThat(test.scan(Scannable.Attr.TERMINATED)).isFalse();
test.complete(Collections.emptyList());
assertThat(test.scan(Scannable.Attr.TERMINATED)).isTrue();
assertThat(test.scan(Scannable.Attr.CANCELLED)).isFalse();
test.cancel();
assertThat(test.scan(Scannable.Attr.CANCELLED)).isTrue();
}
Aggregations