Search in sources :

Example 16 with TestCancellable

use of io.servicetalk.concurrent.api.TestCancellable in project servicetalk by apple.

the class SingleConcatWithCompletableTest method testCancelNext.

@Test
void testCancelNext() {
    source.onSuccess(1);
    assertThat(subscriber.pollTerminal(10, MILLISECONDS), is(nullValue()));
    subscriber.awaitSubscription().cancel();
    TestCancellable sourceCancellable = new TestCancellable();
    source.onSubscribe(sourceCancellable);
    assertFalse(sourceCancellable.isCancelled());
    TestCancellable nextCancellable = new TestCancellable();
    next.onSubscribe(nextCancellable);
    assertTrue(nextCancellable.isCancelled());
}
Also used : TestCancellable(io.servicetalk.concurrent.api.TestCancellable) Test(org.junit.jupiter.api.Test)

Aggregations

TestCancellable (io.servicetalk.concurrent.api.TestCancellable)16 Test (org.junit.jupiter.api.Test)12 TestCompletable (io.servicetalk.concurrent.api.TestCompletable)4 TestPublisherSubscriber (io.servicetalk.concurrent.test.internal.TestPublisherSubscriber)3 Thread.currentThread (java.lang.Thread.currentThread)3 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 Cancellable (io.servicetalk.concurrent.Cancellable)2 DelegatingExecutor (io.servicetalk.concurrent.api.DelegatingExecutor)2 TestSubscription (io.servicetalk.concurrent.api.TestSubscription)2 TimeUnit (java.util.concurrent.TimeUnit)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 ValueSource (org.junit.jupiter.params.provider.ValueSource)2 Executor (io.servicetalk.concurrent.api.Executor)1 ExecutorExtension (io.servicetalk.concurrent.api.ExecutorExtension)1 Single (io.servicetalk.concurrent.api.Single)1 SourceAdapters.toSource (io.servicetalk.concurrent.api.SourceAdapters.toSource)1 TestPublisher (io.servicetalk.concurrent.api.TestPublisher)1 TestSingle (io.servicetalk.concurrent.api.TestSingle)1 DELIBERATE_EXCEPTION (io.servicetalk.concurrent.internal.DeliberateException.DELIBERATE_EXCEPTION)1