@Test
void healthyWithRetry() {

  when(memoryMonitor.isMemoryHealthy(anyLong())).thenThrow(
      ElasticsearchMemoryHealthy.MemoryUsageExceedException.class).thenReturn(true);
  ElasticsearchResourceMonitor resourceMonitor =
      new ElasticsearchResourceMonitor(settings, memoryMonitor);
  assertTrue(resourceMonitor.isHealthy());
  verify(memoryMonitor, times(2)).isMemoryHealthy(anyLong());
}