use of org.reactivestreams.Subscription in project reactor-core by reactor.
the class MonoPublishOnTest method scanSubscriber.
@Test
public void scanSubscriber() {
CoreSubscriber<String> actual = new LambdaMonoSubscriber<>(null, e -> {
}, null, null);
MonoPublishOn.PublishOnSubscriber<String> test = new MonoPublishOn.PublishOnSubscriber<>(actual, Schedulers.single());
Subscription parent = Operators.emptySubscription();
test.onSubscribe(parent);
Assertions.assertThat(test.scan(Scannable.Attr.RUN_ON)).isSameAs(Schedulers.single());
Assertions.assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent);
Assertions.assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(actual);
Assertions.assertThat(test.scan(Scannable.Attr.CANCELLED)).isFalse();
test.cancel();
Assertions.assertThat(test.scan(Scannable.Attr.CANCELLED)).isTrue();
}
use of org.reactivestreams.Subscription in project reactor-core by reactor.
the class MonoReduceSeedTest method scanSubscriber.
@Test
public void scanSubscriber() {
CoreSubscriber<String> actual = new LambdaMonoSubscriber<>(null, e -> {
}, null, null);
MonoReduceSeed.ReduceSeedSubscriber<Integer, String> test = new MonoReduceSeed.ReduceSeedSubscriber<>(actual, (s, i) -> s + i, "foo");
Subscription parent = Operators.emptySubscription();
test.onSubscribe(parent);
assertThat(test.scan(Scannable.Attr.PREFETCH)).isEqualTo(Integer.MAX_VALUE);
assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent);
assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(actual);
assertThat(test.scan(Scannable.Attr.TERMINATED)).isFalse();
test.onError(new IllegalStateException("boom"));
assertThat(test.scan(Scannable.Attr.TERMINATED)).isTrue();
assertThat(test.scan(Scannable.Attr.CANCELLED)).isFalse();
test.cancel();
assertThat(test.scan(Scannable.Attr.CANCELLED)).isTrue();
}
use of org.reactivestreams.Subscription in project reactor-core by reactor.
the class LambdaMonoSubscriberTest method scan.
@Test
public void scan() {
LambdaMonoSubscriber<String> test = new LambdaMonoSubscriber<>(null, null, null, null);
Subscription parent = Operators.emptySubscription();
test.onSubscribe(parent);
Assertions.assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent);
Assertions.assertThat(test.scan(Scannable.Attr.PREFETCH)).isEqualTo(Integer.MAX_VALUE);
Assertions.assertThat(test.scan(Scannable.Attr.TERMINATED)).isFalse();
Assertions.assertThat(test.scan(Scannable.Attr.CANCELLED)).isFalse();
test.dispose();
Assertions.assertThat(test.scan(Scannable.Attr.TERMINATED)).isTrue();
Assertions.assertThat(test.scan(Scannable.Attr.CANCELLED)).isTrue();
}
use of org.reactivestreams.Subscription in project reactor-core by reactor.
the class MonoAllTest method scanSubscriber.
@Test
public void scanSubscriber() {
CoreSubscriber<Boolean> actual = new LambdaMonoSubscriber<>(null, e -> {
}, null, null);
MonoAll.AllSubscriber<String> test = new MonoAll.AllSubscriber<>(actual, String::isEmpty);
Subscription parent = Operators.emptySubscription();
test.onSubscribe(parent);
assertThat(test.scan(Scannable.Attr.PREFETCH)).isEqualTo(Integer.MAX_VALUE);
assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent);
assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(actual);
assertThat(test.scan(Scannable.Attr.TERMINATED)).isFalse();
test.onError(new IllegalStateException("boom"));
assertThat(test.scan(Scannable.Attr.TERMINATED)).isTrue();
assertThat(test.scan(Scannable.Attr.CANCELLED)).isFalse();
test.cancel();
assertThat(test.scan(Scannable.Attr.CANCELLED)).isTrue();
}
use of org.reactivestreams.Subscription in project reactor-core by reactor.
the class MonoAnyTest method scanSubscriber.
@Test
public void scanSubscriber() {
CoreSubscriber<Boolean> actual = new LambdaMonoSubscriber<>(null, e -> {
}, null, null);
MonoAny.AnySubscriber<String> test = new MonoAny.AnySubscriber<>(actual, String::isEmpty);
Subscription parent = Operators.emptySubscription();
test.onSubscribe(parent);
assertThat(test.scan(Scannable.Attr.PREFETCH)).isEqualTo(Integer.MAX_VALUE);
assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent);
assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(actual);
assertThat(test.scan(Scannable.Attr.TERMINATED)).isFalse();
test.onError(new IllegalStateException("boom"));
assertThat(test.scan(Scannable.Attr.TERMINATED)).isTrue();
assertThat(test.scan(Scannable.Attr.CANCELLED)).isFalse();
test.cancel();
assertThat(test.scan(Scannable.Attr.CANCELLED)).isTrue();
}
Aggregations