  @Test
  public void testConsumeCompletionWithReceiveFailure() {

    urlSetup("receiveFailure", "receiveFailureUrl");

    CompletableFuture<ReceiveMessageResponse> receiveMessage = new CompletableFuture<>();
    receiveMessage.completeExceptionally(new Exception());
    ReceiveMessageRequest testRequest =
        ReceiveMessageRequest.builder()
            .queueUrl("receiveFailureUrl")
            .maxNumberOfMessages(1)
            .waitTimeSeconds(AsyncSqsClientConfiguration.DEFAULT_RECEIVE_WAIT_SECONDS)
            .build();
    when(awsAsyncSqsClient.receiveMessage(testRequest)).thenReturn(receiveMessage);

    // ensure future is completed when exception in receiveMessage
    Consumer<String> function = System.out::println;
    CompletableFuture<Boolean> result = asyncClient.consume(function, "receiveFailure");

    try {
      result.get(1000, TimeUnit.MICROSECONDS);
    } catch (TimeoutException timeout) {
      fail("Future does not seem to complete when failure in receiveMessage.");
    } catch (Exception ex) {
    }

    urlFailureSetup("receiveFailure");
    // ensure future is completed when exception in get URL within getMessage
    result = asyncClient.consume(function, "receiveFailure");

    try {
      result.get(1000, TimeUnit.MILLISECONDS);
    } catch (TimeoutException timeout) {
      fail("Future does not seem to complete when failure in getQueueUrl within receiveMessage.");
    } catch (Exception ex) {
    }
  }