@Override
    public Map<String, Metric> getMetrics() {
        return metricRegistry.getMetrics();
    }
@Test
    public void shouldReturnTotalNumberOfRequestsAs3ForFailAsync() {
        AsyncHelloWorldService helloWorldService = mock(AsyncHelloWorldService.class);
        ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();

        CompletableFuture<String> failedFuture = new CompletableFuture<>();
        failedFuture.completeExceptionally(new HelloWorldException());
        given(helloWorldService.returnHelloWorld())
            .willReturn(failedFuture)
            .willReturn(completedFuture("Success"));

        Retry retry = Retry.of("metrics", RetryConfig.<String>custom()
            .retryExceptions(Exception.class)
            .maxAttempts(5)
            .failAfterMaxAttempts(true)
            .build());

        Supplier<CompletionStage<String>> supplier = Retry.decorateCompletionStage(retry, scheduler, helloWorldService::returnHelloWorld);

        String result = awaitResult(supplier.get(), 5);

        assertThat(retry.getMetrics().getNumberOfTotalCalls()).isEqualTo(2);
        assertThat(result).isEqualTo("Success");
    }