@Test
public void testInstanceSharing() throws IOException {

  // Two lease renewers with the same UGI should return
  // the same instance
  LeaseRenewer lr = LeaseRenewer.getInstance(
      FAKE_AUTHORITY, FAKE_UGI_A, MOCK_DFSCLIENT);
  LeaseRenewer lr2 = LeaseRenewer.getInstance(
      FAKE_AUTHORITY, FAKE_UGI_A, MOCK_DFSCLIENT);
  Assert.assertSame(lr, lr2);
  // But a different UGI should return a different instance
  LeaseRenewer lr3 = LeaseRenewer.getInstance(
      FAKE_AUTHORITY, FAKE_UGI_B, MOCK_DFSCLIENT);
  Assert.assertNotSame(lr, lr3);
  // A different authority with same UGI should also be a different
  // instance.
  LeaseRenewer lr4 = LeaseRenewer.getInstance(
      "someOtherAuthority", FAKE_UGI_B, MOCK_DFSCLIENT);
  Assert.assertNotSame(lr, lr4);
  Assert.assertNotSame(lr3, lr4);
}