@Test
public void testRename() throws IOException {

  // Rename a file
  fileContextTestHelper.createFile(fc, "/newDir/foo");
  fc.rename(new Path("/newDir/foo"), new Path("/newDir/fooBar"));
  Assert.assertFalse(exists(fc, new Path("/newDir/foo")));
  Assert.assertFalse(exists(fcTarget, new Path(chrootedTo,"newDir/foo")));
  Assert.assertTrue(isFile(fc, fileContextTestHelper.getTestRootPath(fc,"/newDir/fooBar")));
  Assert.assertTrue(isFile(fcTarget, new Path(chrootedTo,"newDir/fooBar")));
  
  
  // Rename a dir
  fc.mkdir(new Path("/newDir/dirFoo"), FileContext.DEFAULT_PERM, false);
  fc.rename(new Path("/newDir/dirFoo"), new Path("/newDir/dirFooBar"));
  Assert.assertFalse(exists(fc, new Path("/newDir/dirFoo")));
  Assert.assertFalse(exists(fcTarget, new Path(chrootedTo,"newDir/dirFoo")));
  Assert.assertTrue(isDir(fc, fileContextTestHelper.getTestRootPath(fc,"/newDir/dirFooBar")));
  Assert.assertTrue(isDir(fcTarget, new Path(chrootedTo,"newDir/dirFooBar")));
}