@Test
  public void testLockTimeoutAfterRetries() throws TException {
    doReturn(waitLockResponse).when(spyClient).lock(any());
    doReturn(waitLockResponse).when(spyClient).checkLock(eq(dummyLockId));

    assertThatThrownBy(() -> spyOps.doCommit(metadataV2, metadataV1))
        .isInstanceOf(CommitFailedException.class)
        .hasMessageStartingWith("org.apache.iceberg.hive.LockException")
        .hasMessageContaining("Timed out after")
        .hasMessageEndingWith("waiting for lock on hivedb.tbl");
  }
Wraps an ArgumentCaptor to provide data based on the request
iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveCommitLocks.java