use of io.servicetalk.concurrent.internal.DeliberateException in project servicetalk by apple.
the class AbstractWhenOnErrorTest method testCallbackThrowsError.
@Test
void testCallbackThrowsError() {
DeliberateException srcEx = new DeliberateException();
toSource(doError(Single.<String>failed(srcEx), t -> {
throw DELIBERATE_EXCEPTION;
})).subscribe(listener);
assertThat(listener.awaitOnError(), is(srcEx));
}
use of io.servicetalk.concurrent.internal.DeliberateException in project servicetalk by apple.
the class BeforeErrorTest method testCallbackThrowsError.
@Override
@Test
void testCallbackThrowsError() {
DeliberateException srcEx = new DeliberateException();
this.<String>doError(Publisher.failed(srcEx), t1 -> {
throw DELIBERATE_EXCEPTION;
}).subscribe(subscriber);
subscriber.awaitSubscription().request(1);
assertThat(subscriber.awaitOnError(), sameInstance(srcEx));
verifySuppressed(subscriber.awaitOnError(), DELIBERATE_EXCEPTION);
}
use of io.servicetalk.concurrent.internal.DeliberateException in project servicetalk by apple.
the class RetryTest method testMaxRetries.
@Test
void testMaxRetries() {
shouldRetryValue = true;
subscriber.awaitSubscription().request(3);
source.onNext(1, 2);
source.onError(DELIBERATE_EXCEPTION);
assertThat(subscriber.takeOnNext(2), contains(1, 2));
assertThat(subscriber.pollTerminal(10, MILLISECONDS), is(nullValue()));
verify(shouldRetry).test(1, DELIBERATE_EXCEPTION);
shouldRetryValue = false;
DeliberateException fatal = new DeliberateException();
source.onError(fatal);
assertThat(subscriber.awaitOnError(), sameInstance(fatal));
}
use of io.servicetalk.concurrent.internal.DeliberateException in project servicetalk by apple.
the class SingleZip4Test method delayErrorOneFail.
@Test
void delayErrorOneFail() {
toSource(zipDelayError(first, second, third, fourth, SingleZip4Test::combine)).subscribe(subscriber);
subscriber.awaitSubscription();
DeliberateException e1 = new DeliberateException();
second.onError(e1);
assertThat(subscriber.pollTerminal(10, MILLISECONDS), nullValue());
first.onSuccess(1);
third.onSuccess((short) 22);
fourth.onSuccess((byte) 5);
assertThat(subscriber.awaitOnError(), is(e1));
}
use of io.servicetalk.concurrent.internal.DeliberateException in project servicetalk by apple.
the class SingleZip4Test method delayErrorAllFail.
@Test
void delayErrorAllFail() {
toSource(zipDelayError(first, second, third, fourth, SingleZip4Test::combine)).subscribe(subscriber);
subscriber.awaitSubscription();
DeliberateException e1 = new DeliberateException();
second.onError(e1);
assertThat(subscriber.pollTerminal(10, MILLISECONDS), nullValue());
DeliberateException e2 = new DeliberateException();
first.onError(e2);
DeliberateException e3 = new DeliberateException();
third.onError(e3);
DeliberateException e4 = new DeliberateException();
fourth.onError(e4);
assertThat(subscriber.awaitOnError(), is(e1));
assertThat(asList(e1.getSuppressed()), contains(e2, e3, e4));
}
Aggregations