Search in sources :

Example 11 with TestCompletableSubscriber

use of io.servicetalk.concurrent.test.internal.TestCompletableSubscriber in project servicetalk by apple.

the class OnErrorResumeCompletableTest method testErrorSuppressOriginalException.

@Test
void testErrorSuppressOriginalException() {
    subscriber = new TestCompletableSubscriber();
    first = new TestCompletable();
    DeliberateException ex = new DeliberateException();
    toSource(first.onErrorResume(throwable -> {
        throw ex;
    })).subscribe(subscriber);
    first.onError(DELIBERATE_EXCEPTION);
    assertThat(subscriber.awaitOnError(), is(ex));
    assertEquals(1, ex.getSuppressed().length);
    assertSame(DELIBERATE_EXCEPTION, ex.getSuppressed()[0]);
}
Also used : TestCompletableSubscriber(io.servicetalk.concurrent.test.internal.TestCompletableSubscriber) DeliberateException(io.servicetalk.concurrent.internal.DeliberateException) Test(org.junit.jupiter.api.Test)

Example 12 with TestCompletableSubscriber

use of io.servicetalk.concurrent.test.internal.TestCompletableSubscriber in project servicetalk by apple.

the class OnErrorCompletableTest method setUp.

@BeforeEach
void setUp() {
    subscriber = new TestCompletableSubscriber();
    first = new TestCompletable();
}
Also used : TestCompletableSubscriber(io.servicetalk.concurrent.test.internal.TestCompletableSubscriber) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 13 with TestCompletableSubscriber

use of io.servicetalk.concurrent.test.internal.TestCompletableSubscriber in project servicetalk by apple.

the class IterableMergeCompletableDelayErrorTest method testCollectionFailFirstEvent.

@Test
void testCollectionFailFirstEvent() {
    TestCompletableSubscriber subscriber = new TestCompletableSubscriber();
    collectionHolder.init(2).listen(subscriber).fail(1);
    assertThat(subscriber.pollTerminal(10, MILLISECONDS), is(nullValue()));
    collectionHolder.complete(0, 2);
    assertThat(subscriber.awaitOnError(), is(DELIBERATE_EXCEPTION));
}
Also used : TestCompletableSubscriber(io.servicetalk.concurrent.test.internal.TestCompletableSubscriber) Test(org.junit.jupiter.api.Test)

Example 14 with TestCompletableSubscriber

use of io.servicetalk.concurrent.test.internal.TestCompletableSubscriber in project servicetalk by apple.

the class IterableMergeCompletableDelayErrorTest method testIterableMergeWithOne.

@Test
void testIterableMergeWithOne() {
    TestCompletableSubscriber subscriber = new TestCompletableSubscriber();
    iterableHolder.init(1).listen(subscriber).completeAll();
    subscriber.awaitOnComplete();
}
Also used : TestCompletableSubscriber(io.servicetalk.concurrent.test.internal.TestCompletableSubscriber) Test(org.junit.jupiter.api.Test)

Example 15 with TestCompletableSubscriber

use of io.servicetalk.concurrent.test.internal.TestCompletableSubscriber in project servicetalk by apple.

the class IterableMergeCompletableDelayErrorTest method testCollectionCompletion.

@Test
void testCollectionCompletion() {
    TestCompletableSubscriber subscriber = new TestCompletableSubscriber();
    collectionHolder.init(2).listen(subscriber).completeAll();
    subscriber.awaitOnComplete();
}
Also used : TestCompletableSubscriber(io.servicetalk.concurrent.test.internal.TestCompletableSubscriber) Test(org.junit.jupiter.api.Test)

Aggregations

TestCompletableSubscriber (io.servicetalk.concurrent.test.internal.TestCompletableSubscriber)59 Test (org.junit.jupiter.api.Test)53 Completable (io.servicetalk.concurrent.api.Completable)10 BeforeEach (org.junit.jupiter.api.BeforeEach)5 TestCompletable (io.servicetalk.concurrent.api.TestCompletable)3 Channel (io.netty.channel.Channel)1 ChannelFuture (io.netty.channel.ChannelFuture)1 ChannelFutureListener (io.netty.channel.ChannelFutureListener)1 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1 ChannelOutboundHandlerAdapter (io.netty.channel.ChannelOutboundHandlerAdapter)1 ChannelPromise (io.netty.channel.ChannelPromise)1 EventLoop (io.netty.channel.EventLoop)1 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)1 ReferenceCountUtil (io.netty.util.ReferenceCountUtil)1 Cancellable (io.servicetalk.concurrent.Cancellable)1 TestSubscription (io.servicetalk.concurrent.api.TestSubscription)1 DeliberateException (io.servicetalk.concurrent.internal.DeliberateException)1 DELIBERATE_EXCEPTION (io.servicetalk.concurrent.internal.DeliberateException.DELIBERATE_EXCEPTION)1 ContextAwareRetryingHttpClientFilter (io.servicetalk.http.netty.RetryingHttpRequesterFilter.ContextAwareRetryingHttpClientFilter)1 UNSUPPORTED_PROTOCOL_CLOSE_HANDLER (io.servicetalk.transport.netty.internal.CloseHandler.UNSUPPORTED_PROTOCOL_CLOSE_HANDLER)1