@Test
public void testRemoveLeaseWithPrefixPath() throws Exception {

  MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
  cluster.waitActive();
  LeaseManager lm = NameNodeAdapter.getLeaseManager(cluster.getNamesystem());
  lm.addLease("holder1", "/a/b");
  lm.addLease("holder2", "/a/c");
  assertNotNull(lm.getLeaseByPath("/a/b"));
  assertNotNull(lm.getLeaseByPath("/a/c"));
  lm.removeLeaseWithPrefixPath("/a");
  assertNull(lm.getLeaseByPath("/a/b"));
  assertNull(lm.getLeaseByPath("/a/c"));
  lm.addLease("holder1", "/a/b");
  lm.addLease("holder2", "/a/c");
  lm.removeLeaseWithPrefixPath("/a/");
  assertNull(lm.getLeaseByPath("/a/b"));
  assertNull(lm.getLeaseByPath("/a/c"));
}