@Test
void schedule() {

  ThreadPool threadPool = mock(ThreadPool.class);
  when(nodeClient.threadPool()).thenReturn(threadPool);
  doAnswer(
      invocation -> {
        Runnable task = invocation.getArgument(0);
        task.run();
        return null;
      })
      .when(threadPool)
      .schedule(any(), any(), any());
  ElasticsearchNodeClient client =
      new ElasticsearchNodeClient(mock(ClusterService.class), nodeClient);
  AtomicBoolean isRun = new AtomicBoolean(false);
  client.schedule(() -> isRun.set(true));
  assertTrue(isRun.get());
}