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

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

        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);

        assertThat(supplier.get())
            .failsWithin(5, TimeUnit.SECONDS)
            .withThrowableOfType(ExecutionException.class)
            .havingCause();

        assertThat(retry.getMetrics().getNumberOfTotalCalls()).isEqualTo(5);
    }