private void verifyXAttrsPreserved(Path src, Path dst) throws Exception {
    FileStatus srcStatus = fs.getFileStatus(src);
    FileStatus dstStatus = fs.getFileStatus(dst);
    if (srcStatus.isDirectory()) {
      Assert.assertTrue(dstStatus.isDirectory());
      for(FileStatus srcContent: fs.listStatus(src)) {
        Path dstContent = new Path(dst, srcContent.getPath().getName());
        Assert.assertTrue(fs.exists(dstContent));
        verifyXAttrsPreserved(srcContent.getPath(), dstContent);
      }
    } else {
      Assert.assertFalse(dstStatus.isDirectory());
    }
    Map<String, byte[]> values = fs.getXAttrs(dst);
    for(Map.Entry<String, byte[]> value : fs.getXAttrs(src).entrySet()) {
      Assert.assertEquals(new String(value.getValue()), new String(values.get(value.getKey())));
    }
  }
Integration tests for {{@link FileUtils}. Tests run against a {@link HadoopShims.MiniDFSShim}.
itests/hive-unit-hadoop2/src/test/java/org/apache/hadoop/hive/common/TestFileUtils.java