@Test
  public void testRetriesExceedingLimit() {
    AtomicInteger attemptCounter = new AtomicInteger(0);

    // Arrange: Simulate a persistent failure
    OperationRetryHandler.RetryableOperation<String> failingOperation = () -> {
      attemptCounter.incrementAndGet();
      throw new RuntimeException("Persistent failure");
    };

    // Act: Execute the operation
    try {
      retryHandler.executeWithRetry(failingOperation, "testRetriesExceedingLimit");
      fail("Expected IOException");
    } catch (Exception e) {
      assertEquals("Persistent failure", e.getMessage());
    }

    // Assert: The operation should fail after 3 retry attempts
    assertEquals(3, attemptCounter.get()); // 3 retries + 1 initial attempt
  }
Test that an operation is failed after exceeding the maximum number of retries.
ambry-file-transfer/src/test/java/com/github/ambry/filetransfer/utils/OperationRetryHandlerTest.java