public static void executeWithRetries(
      final Function function,
      final RetryBehaviour retryBehaviour
  ) throws Exception {
    executeWithRetries(() -> {
      function.call();
      return null;
    }, retryBehaviour);
  }
@Test
  public void shouldNotRetryIfSupplierThrowsNonRetriableException() throws Exception {
    // Given:
    final AtomicBoolean firstCall = new AtomicBoolean(true);
    final Callable<Object> throwsNonRetriable = () -> {
      if (firstCall.get()) {
        firstCall.set(false);
        throw new RuntimeException("First non-retry exception");
      }
      throw new RuntimeException("Test should not retry");
    };

    // When:
    final RuntimeException e = assertThrows(
        RuntimeException.class,
        () -> ExecutorUtil.executeWithRetries(throwsNonRetriable, ON_RETRYABLE)
    );

    // Then:
    assertThat(e.getMessage(), containsString("First non-retry exception"));
  }