use of io.servicetalk.concurrent.internal.DeliberateException in project servicetalk by apple.
the class SingleZipWithTest method delayErrorAllFail.
@Test
void delayErrorAllFail() {
toSource(first.zipWithDelayError(second, SingleZipWithTest::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);
assertThat(subscriber.awaitOnError(), is(e1));
assertThat(asList(e1.getSuppressed()), contains(e2));
}
use of io.servicetalk.concurrent.internal.DeliberateException in project servicetalk by apple.
the class AfterFinallyTest method testCallbackThrowsErrorOnError.
@Test
@Override
void testCallbackThrowsErrorOnError() {
TerminalSignalConsumer mock = throwableMock(new DeliberateException());
toSource(doFinally(Completable.failed(DELIBERATE_EXCEPTION), mock)).subscribe(listener);
assertThat(listener.awaitOnError(), is(DELIBERATE_EXCEPTION));
verify(mock).onError(DELIBERATE_EXCEPTION);
verifyNoMoreInteractions(mock);
}
use of io.servicetalk.concurrent.internal.DeliberateException in project servicetalk by apple.
the class BeforeFinallyTest method testCallbackThrowsErrorOnError.
@Override
@Test
void testCallbackThrowsErrorOnError() {
DeliberateException exception = new DeliberateException();
TerminalSignalConsumer mock = throwableMock(exception);
doFinally(publisher, mock).subscribe(subscriber);
publisher.onError(DELIBERATE_EXCEPTION);
Throwable receivedError = subscriber.awaitOnError();
assertThat(receivedError, is(notNullValue()));
assertThat(receivedError, sameInstance(exception));
assertThat(receivedError.getSuppressed()[0], sameInstance(DELIBERATE_EXCEPTION));
verify(mock).onError(DELIBERATE_EXCEPTION);
verifyNoMoreInteractions(mock);
assertFalse(subscription.isCancelled());
}
use of io.servicetalk.concurrent.internal.DeliberateException in project servicetalk by apple.
the class BeforeFinallyTest method testCallbackThrowsErrorOnError.
@Test
@Override
void testCallbackThrowsErrorOnError() {
DeliberateException exception = new DeliberateException();
TerminalSignalConsumer mock = throwableMock(exception);
toSource(doFinally(Completable.failed(DELIBERATE_EXCEPTION), mock)).subscribe(listener);
assertThat(listener.awaitOnError(), is(exception));
assertThat(listener.awaitOnError().getSuppressed()[0], is(DELIBERATE_EXCEPTION));
verify(mock).onError(DELIBERATE_EXCEPTION);
verifyNoMoreInteractions(mock);
}
use of io.servicetalk.concurrent.internal.DeliberateException in project servicetalk by apple.
the class AbstractWhenCancelTest method testCallbackThrowsError.
@Test
void testCallbackThrowsError() {
LegacyTestCompletable completable = new LegacyTestCompletable();
DeliberateException e = assertThrows(DeliberateException.class, () -> {
try {
toSource(doCancel(completable, () -> {
throw DELIBERATE_EXCEPTION;
})).subscribe(listener);
listener.awaitSubscription().cancel();
} finally {
completable.verifyCancelled();
}
});
assertThat(e, is(sameInstance(DELIBERATE_EXCEPTION)));
}
Aggregations