use of io.servicetalk.concurrent.api.TerminalSignalConsumer in project servicetalk by apple.
the class BeforeFinallyTest method testCallbackThrowsErrorOnComplete.
@Override
@Test
void testCallbackThrowsErrorOnComplete() {
TerminalSignalConsumer mock = throwableMock(DELIBERATE_EXCEPTION);
doFinally(publisher, mock).subscribe(subscriber);
assertFalse(subscription.isCancelled());
publisher.onComplete();
Throwable receivedError = subscriber.awaitOnError();
assertThat(receivedError, is(notNullValue()));
assertThat(receivedError, sameInstance(DELIBERATE_EXCEPTION));
verify(mock).onComplete();
verifyNoMoreInteractions(mock);
assertFalse(subscription.isCancelled());
}
Aggregations