@Test
public void testRename() {

  final String NEW_FILE_NAME = "test-new.mapfile";
  final String OLD_FILE_NAME = "test-old.mapfile";
  MapFile.Writer writer = null;
  try {
    FileSystem fs = FileSystem.getLocal(conf);
    writer = createWriter(OLD_FILE_NAME, IntWritable.class, IntWritable.class);
    writer.close();
    MapFile.rename(fs, new Path(TEST_DIR, OLD_FILE_NAME).toString(), 
        new Path(TEST_DIR, NEW_FILE_NAME).toString());
    MapFile.delete(fs, new Path(TEST_DIR, NEW_FILE_NAME).toString());
  } catch (IOException ex) {
    fail("testRename error " + ex);
  } finally {
    IOUtils.cleanupWithLogger(LOG, writer);
  }
}