use of com.google.cloud.pubsublite.internal.wire.Subscriber in project beam by apache.
the class SubscriptionPartitionProcessorImplTest method subscriberFailureFails.
@Test
public void subscriberFailureFails() throws Exception {
when(tracker.currentRestriction()).thenReturn(initialRange());
doAnswer((Answer<Void>) args -> {
subscriber.fail(new CheckedApiException(Code.OUT_OF_RANGE));
return null;
}).when(subscriber).awaitRunning();
ApiException e = assertThrows(// Longer wait is needed due to listener asynchrony, but should never wait this long.
ApiException.class, () -> processor.runFor(Duration.standardMinutes(2)));
assertEquals(Code.OUT_OF_RANGE, e.getStatusCode().getCode());
}
Aggregations