@Test
  public void testRetryUntilSuccess() throws Exception {
    AtomicInteger attemptCounter = new AtomicInteger(0);

    // Arrange: Simulate 2 failures and 1 success
    OperationRetryHandler.RetryableOperation<String> operation = () -> {
      if (attemptCounter.incrementAndGet() < 3) {
        throw new IOException("Simulated failure");
      }
      return "Success";
    };

    // Act: Execute the operation
    String result = retryHandler.executeWithRetry(operation, "testRetryUntilSuccess");

    // Assert: The operation should succeed after 3 retry attempts
    assertEquals("Success", result);
    assertEquals(3, attemptCounter.get()); // 2 failures + 1 success
  }
Test that am operation is executed until it succeeds for a maximum of 3 attempts.
ambry-file-transfer/src/test/java/com/github/ambry/filetransfer/utils/OperationRetryHandlerTest.java