@Test
  public void testLeaseRecoverable() throws IOException {
    try {
      // set LeaseRecoverable to FakeLeaseRecoverable for testing
      RecoverLeaseFSUtils.initializeRecoverLeaseMethod(FakeLeaseRecoverable.class.getName());
      RecoverableFileSystem mockFS = mock(RecoverableFileSystem.class);
      when(mockFS.recoverLease(FILE)).thenReturn(true);
      RecoverLeaseFSUtils.recoverFileLease(mockFS, FILE, HTU.getConfiguration());
      verify(mockFS, times(1)).recoverLease(FILE);

      assertTrue(RecoverLeaseFSUtils.isLeaseRecoverable(mock(RecoverableFileSystem.class)));
    } finally {
      RecoverLeaseFSUtils.initializeRecoverLeaseMethod(LEASE_RECOVERABLE_CLASS_NAME);
    }
  }
Test that we can use reflection to access LeaseRecoverable methods.
hbase-asyncfs/src/test/java/org/apache/hadoop/hbase/util/TestRecoverLeaseFSUtils.java