use of com.couchbase.client.core.msg.kv.NoopResponse in project couchbase-jvm-clients by couchbase.
the class ReactorTest method noErrorDroppedWhenCancelledViaRequestCanceledException.
@Test
void noErrorDroppedWhenCancelledViaRequestCanceledException() {
AtomicInteger droppedErrors = new AtomicInteger(0);
Hooks.onErrorDropped(v -> {
droppedErrors.incrementAndGet();
});
NoopRequest request = new NoopRequest(Duration.ZERO, mock(RequestContext.class), mock(RetryStrategy.class), mock(CollectionIdentifier.class));
// Because this is a single-stage CompleteableFuture, the RequestCanceledException will raised directly in the
// internals.
Mono<NoopResponse> mono = Reactor.wrap(request, request.response(), true);
Disposable subscriber = mono.subscribe();
StepVerifier verifier = StepVerifier.create(mono).expectError(RequestCanceledException.class);
subscriber.dispose();
verifier.verify();
assertEquals(0, droppedErrors.get());
}
Aggregations