private ScheduledExecutorService mockExecutorService(MockTime time) {
        MockExecutorService mockExecutorService = new MockExecutorService(time);
        ScheduledExecutorService executorService = Mockito.mock(ScheduledExecutorService.class);
        Mockito.doAnswer(invocation -> {
            Runnable command = invocation.getArgument(0, Runnable.class);
            long delay = invocation.getArgument(1, Long.class);
            TimeUnit unit = invocation.getArgument(2, TimeUnit.class);
            return mockExecutorService.schedule(() -> {
                command.run();
                return null;
            }, unit.toMillis(delay), null);
        }).when(executorService).schedule(Mockito.any(Runnable.class), Mockito.anyLong(), Mockito.any(TimeUnit.class));
        Mockito.doAnswer(invocation -> {
            Runnable command = invocation.getArgument(0, Runnable.class);
            long initialDelay = invocation.getArgument(1, Long.class);
            long period = invocation.getArgument(2, Long.class);
            TimeUnit unit = invocation.getArgument(3, TimeUnit.class);
            return mockExecutorService.schedule(() -> {
                command.run();
                return null;
            }, unit.toMillis(initialDelay), period);
        }).when(executorService).scheduleAtFixedRate(Mockito.any(Runnable.class), Mockito.anyLong(), Mockito.anyLong(), Mockito.any(TimeUnit.class));
        return executorService;
    }
Test that if we ask to load a missing key, and then we wait past the sleep time that it will
call refresh to load the key.
clients/src/test/java/org/apache/kafka/common/security/oauthbearer/internals/secured/RefreshingHttpsJwksTest.java