@VisibleForTesting
    static CompletableFuture<JobResult> pollJobResultAsync(
            final Supplier<CompletableFuture<JobStatus>> jobStatusSupplier,
            final Supplier<CompletableFuture<JobResult>> jobResultSupplier,
            final ScheduledExecutor scheduledExecutor,
            final long retryMsTimeout) {
        return pollJobResultAsync(
                jobStatusSupplier,
                jobResultSupplier,
                scheduledExecutor,
                new CompletableFuture<>(),
                retryMsTimeout,
                0);
    }
@Test
    void testPolling() {
        final int maxAttemptCounter = 3;
        final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
        try {
            final ScheduledExecutor scheduledExecutor =
                    new ScheduledExecutorServiceAdapter(executor);

            final CallCountingJobStatusSupplier jobStatusSupplier =
                    new CallCountingJobStatusSupplier(maxAttemptCounter);

            final CompletableFuture<JobResult> result =
                    JobStatusPollingUtils.pollJobResultAsync(
                            jobStatusSupplier,
                            () ->
                                    CompletableFuture.completedFuture(
                                            createSuccessfulJobResult(new JobID(0, 0))),
                            scheduledExecutor,
                            10);

            result.join();

            assertThat(jobStatusSupplier.getAttemptCounter()).isEqualTo(maxAttemptCounter);

        } finally {
            ExecutorUtils.gracefulShutdown(5, TimeUnit.SECONDS, executor);
        }
    }